Merge "Reset timeout exception in DietTestCase when retrying" into stable/stein

This commit is contained in:
Zuul 2020-02-08 20:14:47 +00:00 committed by Gerrit Code Review
commit 6bae6789e2
1 changed files with 9 additions and 6 deletions

View File

@ -42,6 +42,7 @@ from oslotest import base
import six import six
from sqlalchemy import exc as sqlalchemy_exc from sqlalchemy import exc as sqlalchemy_exc
import testtools import testtools
from testtools import content
from neutron._i18n import _ from neutron._i18n import _
from neutron.agent.linux import external_process from neutron.agent.linux import external_process
@ -186,12 +187,14 @@ def _catch_timeout(f):
# declarations) this catch can be remove. # declarations) this catch can be remove.
# [1] https://review.opendev.org/#/c/631275/ # [1] https://review.opendev.org/#/c/631275/
except fixtures.TimeoutException: except fixtures.TimeoutException:
with excutils.save_and_reraise_exception() as ctxt: if idx < TESTCASE_RETRIES:
if idx < TESTCASE_RETRIES: msg = ('"fixtures.TimeoutException" during test case '
msg = ('"fixtures.TimeoutException" during test case ' 'execution no %s; test case re-executed' % idx)
'execution no %s; test case re-executed' % idx) self.addDetail('DietTestCase',
self.addDetail('DietTestCase', msg) content.text_content(msg))
ctxt.reraise = False self._set_timeout()
else:
self.fail('Execution of this test timed out')
return func return func