diff --git a/addons/web/tests/test_js.py b/addons/web/tests/test_js.py index 8394b796d5d..8738be28e7b 100644 --- a/addons/web/tests/test_js.py +++ b/addons/web/tests/test_js.py @@ -10,6 +10,7 @@ RE_ONLY = re.compile(r'QUnit\.(only|debug)\(') @odoo.tests.tagged('post_install', '-at_install') class WebSuite(odoo.tests.HttpCase): + @odoo.tests.no_retry def test_js(self): # webclient desktop test suite self.browser_js('/web/tests?mod=web', "", "", login='admin', timeout=1800) diff --git a/odoo/tests/common.py b/odoo/tests/common.py index 6495d59d5c2..a34c6536aaa 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -388,7 +388,14 @@ class BaseCase(unittest.TestCase, metaclass=MetaCase): self.addTypeEqualityFunc(html.HtmlElement, self.assertTreesEqual) def run(self, result): - tests_run_count = int(os.environ.get('ODOO_TEST_FAILURE_RETRIES', 0)) + 1 + testMethod = getattr(self, self._testMethodName) + + if getattr(testMethod, '_retry', True) and getattr(self, '_retry', True): + tests_run_count = int(os.environ.get('ODOO_TEST_FAILURE_RETRIES', 0)) + 1 + else: + tests_run_count = 1 + _logger.info('Auto retry disabled for %s', self) + failure = False for retry in range(tests_run_count): if retry: @@ -1768,6 +1775,12 @@ class HttpSavepointCase(HttpCase): ) +def no_retry(arg): + """Disable auto retry on decorated test method or test class""" + arg._retry = False + return arg + + def users(*logins): """ Decorate a method to execute it once for each given user. """ @decorator