summaryrefslogtreecommitdiff
path: root/odoo/tests/loader.py
diff options
context:
space:
mode:
Diffstat (limited to 'odoo/tests/loader.py')
-rw-r--r--odoo/tests/loader.py14
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):