diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-09-13 18:07:59 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-09-13 18:07:59 +0200 |
| commit | 6c948c36bbf72dd896e0bff03aa7fbddadcbb0cd (patch) | |
| tree | f8620905c011735d8a3c340c46d1417a54a75972 /odoo/modules/module.py | |
| parent | 48503fcf08eac6fed12e080d4f501f9bbc8d257d (diff) | |
| parent | 197474e5b9ad43ab2d587a98136a1a809ce9a2e7 (diff) | |
[MERGE] forward port branch saas-12.5 up to 197474e5b9a
Diffstat (limited to 'odoo/modules/module.py')
| -rw-r--r-- | odoo/modules/module.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/odoo/modules/module.py b/odoo/modules/module.py index ddbd0ce31ae..2c06bca742b 100644 --- a/odoo/modules/module.py +++ b/odoo/modules/module.py @@ -492,8 +492,9 @@ class OdooTestResult(unittest.result.TestResult): # using logger.log makes it difficult to spot-replace findCaller in # order to provide useful location information (the problematic spot # inside the test function), so use lower-level functions instead - record = logger.makeRecord(logger.name, level, fn, lno, msg, args, exc_info, func, extra, sinfo) - logger.handle(record) + if logger.isEnabledFor(level): + record = logger.makeRecord(logger.name, level, fn, lno, msg, args, exc_info, func, extra, sinfo) + logger.handle(record) def getDescription(self, test): if isinstance(test, unittest.case._SubTest): @@ -549,6 +550,8 @@ class OdooTestResult(unittest.result.TestResult): """ # only test case should be executed in odoo, this is only a safe guard + if isinstance(test, unittest.suite._ErrorHolder): + return if not isinstance(test, unittest.TestCase): _logger.warning('%r is not a TestCase' % test) return @@ -576,10 +579,8 @@ class OdooTestRunner(object): start_time = time.perf_counter() test(result) time_taken = time.perf_counter() - start_time - - logger = logging.getLogger(test.__module__) run = result.testsRun - logger.info("Ran %d test%s in %.3fs", run, run != 1 and "s" or "", time_taken) + _logger.info("Ran %d test%s in %.3fs", run, run != 1 and "s" or "", time_taken) return result current_test = None |
