diff options
| author | Xavier Morel <xmo@odoo.com> | 2020-07-28 09:38:14 +0000 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2020-08-19 14:08:12 +0000 |
| commit | c1c43bbe3808c3685e018148b6b6ea242743683c (patch) | |
| tree | 15c9f8a2a29bccb7a1363819614a24b44d421ad8 /odoo/tests/loader.py | |
| parent | ec8a64a85c7ce751bbd4fc3b5a2a8224a84c81d0 (diff) | |
[REM] core: assertion reports
That's a not-very-useful subset of OdooTestResult, so:
* make results merge-able (aka add ability to update a result with the
contents of another)
* remove support for test data files, and transmission of the
assertion report thing through the data-files loading
* replace "legitimate" uses of assertion report by test result
* have run_unit_tests manipulate and return a result instead of weird
flags & ternaries
Diffstat (limited to 'odoo/tests/loader.py')
| -rw-r--r-- | odoo/tests/loader.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/odoo/tests/loader.py b/odoo/tests/loader.py index c2cc53452fa..99df113a82e 100644 --- a/odoo/tests/loader.py +++ b/odoo/tests/loader.py @@ -9,7 +9,7 @@ import unittest import odoo from .. import tools from .common import TagsSelector, OdooSuite -from .runner import OdooTestRunner +from .runner import OdooTestRunner, OdooTestResult # backwards compatibility _logger = logging.getLogger('odoo.modules.module') @@ -67,7 +67,8 @@ def run_unit_tests(module_name, position='at_install'): threading.currentThread().testing = True config_tags = TagsSelector(tools.config['test_tags']) position_tag = TagsSelector(position) - ran_tests = failures = False + + results = OdooTestResult() for m in mods: tests = unwrap_suite(unittest.TestLoader().loadTestsFromModule(m)) suite = OdooSuite(t for t in tests if position_tag.check(t) and config_tags.check(t)) @@ -77,23 +78,18 @@ def run_unit_tests(module_name, position='at_install'): t0_sql = odoo.sql_db.sql_counter _logger.info('%s running tests.', m.__name__) result = OdooTestRunner().run(suite) + results.update(result) log_level = logging.INFO if time.time() - t0 > 5: log_level = logging.RUNBOT _logger.log(log_level, "%s ran %s tests in %.2fs, %s queries", m.__name__, result.testsRun, time.time() - t0, odoo.sql_db.sql_counter - t0_sql) - ran_tests = True if not result.wasSuccessful(): - failures = True _logger.error("Module %s: %d failures, %d errors", module_name, len(result.failures), len(result.errors)) module.current_test = None threading.currentThread().testing = False - if failures: - return False - if ran_tests: - return True - return None + return results def unwrap_suite(test): |
