Merge "Remove deprecated eventlet TimeoutError exception"

This commit is contained in:
Jenkins
2017-05-15 04:51:24 +00:00
committed by Gerrit Code Review
4 changed files with 8 additions and 8 deletions

View File

@@ -684,10 +684,10 @@ def wait_until_true(predicate, timeout=60, sleep=1, exception=None):
(default) then WaitTimeout exception is raised.
"""
try:
with eventlet.timeout.Timeout(timeout):
with eventlet.Timeout(timeout):
while not predicate():
eventlet.sleep(sleep)
except eventlet.TimeoutError:
except eventlet.Timeout:
if exception is not None:
#pylint: disable=raising-bad-type
raise exception

View File

@@ -69,7 +69,7 @@ class OpenFlowSwitchMixin(object):
def _send_msg(self, msg, reply_cls=None, reply_multi=False):
timeout_sec = cfg.CONF.OVS.of_request_timeout
timeout = eventlet.timeout.Timeout(seconds=timeout_sec)
timeout = eventlet.Timeout(seconds=timeout_sec)
try:
result = ofctl_api.send_msg(self._app, msg, reply_cls, reply_multi)
except ryu_exc.RyuException as e:
@@ -80,7 +80,7 @@ class OpenFlowSwitchMixin(object):
LOG.error(m)
# NOTE(yamamoto): use RuntimeError for compat with ovs_lib
raise RuntimeError(m)
except eventlet.timeout.Timeout as e:
except eventlet.Timeout as e:
with excutils.save_and_reraise_exception() as ctx:
if e is timeout:
ctx.reraise = False

View File

@@ -113,7 +113,7 @@ def _catch_timeout(f):
def func(self, *args, **kwargs):
try:
return f(self, *args, **kwargs)
except eventlet.timeout.Timeout as e:
except eventlet.Timeout as e:
self.fail('Execution of this test timed out: %s' % e)
return func
@@ -206,7 +206,7 @@ class DietTestCase(base.BaseTestCase):
@contextlib.contextmanager
def assert_max_execution_time(self, max_execution_time=5):
with eventlet.timeout.Timeout(max_execution_time, False):
with eventlet.Timeout(max_execution_time, False):
yield
return
self.fail('Execution of this test timed out')

View File

@@ -78,7 +78,7 @@ class CatchTimeoutTestCase(base.DietTestCase):
# Embedded to hide from the regular test discovery
class MyTestCase(base.DietTestCase):
def test_case(self):
raise eventlet.timeout.Timeout()
raise eventlet.Timeout()
def runTest(self):
return self.test_case()
@@ -87,5 +87,5 @@ class CatchTimeoutTestCase(base.DietTestCase):
try:
result = self.MyTestCase().run()
self.assertFalse(result.wasSuccessful())
except eventlet.timeout.Timeout:
except eventlet.Timeout:
self.fail('Timeout escaped!')