[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>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user