[IMP] tests: enable warnings even when retrying tests
When retrying a test, if a deprecation warning has been emitted the first time, it will not be re-emitted the second time, and will therefore not be shown in logs. Use warnings.catch_warnings() to reset the "emission counter" of the warnings. Part-of: odoo/odoo#92411
This commit is contained in:
@@ -360,7 +360,9 @@ class BaseCase(unittest.TestCase, metaclass=MetaCase):
|
||||
if retry:
|
||||
_logger.runbot(f'Retrying a failed test: {self}')
|
||||
if retry < tests_run_count-1:
|
||||
with result.soft_fail(), lower_logging(25, logging.INFO) as quiet_log:
|
||||
with warnings.catch_warnings(), \
|
||||
result.soft_fail(), \
|
||||
lower_logging(25, logging.INFO) as quiet_log:
|
||||
super().run(result)
|
||||
failure = result.had_failure or quiet_log.had_error_log
|
||||
else: # last try
|
||||
|
||||
Reference in New Issue
Block a user