diff options
| author | Xavier-Do <xdo@odoo.com> | 2019-07-18 15:10:57 +0000 |
|---|---|---|
| committer | Xavier-Do <xdo@odoo.com> | 2019-07-25 12:09:27 +0000 |
| commit | 735ee5487c7b312918f8a7ea46fd271c3c9957de (patch) | |
| tree | aa509c49c2e0a25bec9050ada3e7fa011e49ab8e /odoo/modules/loading.py | |
| parent | 16589ddc19642699bac97ff9bad15043559ced0f (diff) | |
[IMP] core: improve test logs
1. Make test logs clearer & remove redundancies
Instead of having an ERROR log right when the test fails then print
the useful / relevant information at the end of the test suite,
immediately print the traceback. Keep the final summary. Also avoids
having to wait for the entire test suite to end before a dev' can know
the failure details of a specific test.
Done by working at a lower level and replacing the custom
test stream mess by a custom Result class which prints and formats the
information we want. Replace TextTestRunner by a bare-bones custom
Runner object to tie it in.
2. Provide useful location information on test failure
Leverage the work above to log the test function's failure location:
previously logging would point to within TestStream which is not
useful.
Here, on failure the traceback is used to discover the caller info and
point to the test line which fails instead. similar to unittest's
_exc_info_to_string (https://github.com/python/cpython/blob/93e8aa62cfd0a61efed4a61a2ffc2283ae986ef2/Lib/unittest/result.py#L173).
3. Replace direct logging in browser_js by raising errors
Properly marks the test as in error, and the error traceback points to
the tour definition / launcher (python side) rather than common.py
and/or module.py.
Also removes unused dbname parameter that was added in
/278ed718e9805edf088642ba10d3b7c4e5716c31/openerp/modules/module.py#L361
for nor visible reason
closes odoo/odoo#34996
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'odoo/modules/loading.py')
| -rw-r--r-- | odoo/modules/loading.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index e256711e06f..de6b07e01ca 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -251,7 +251,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, report.record_result(load_test(idref, mode)) # Python tests env['ir.http']._clear_routing_map() # force routing map to be rebuilt - report.record_result(odoo.modules.module.run_unit_tests(module_name, cr.dbname)) + report.record_result(odoo.modules.module.run_unit_tests(module_name)) # tests may have reset the environment env = api.Environment(cr, SUPERUSER_ID, {}) module = env['ir.module.module'].browse(module_id) |
