Commit 6edf835b authored by Denis Bilenko's avatar Denis Bilenko

GenericGetTestCase: add ability to customize timeout exception

parent 32fb083c
...@@ -302,6 +302,8 @@ class GenericWaitTestCase(TestCase): ...@@ -302,6 +302,8 @@ class GenericWaitTestCase(TestCase):
class GenericGetTestCase(TestCase): class GenericGetTestCase(TestCase):
Timeout = gevent.Timeout
def wait(self, timeout): def wait(self, timeout):
raise NotImplementedError('override me in subclass') raise NotImplementedError('override me in subclass')
...@@ -312,7 +314,7 @@ class GenericGetTestCase(TestCase): ...@@ -312,7 +314,7 @@ class GenericGetTestCase(TestCase):
def test_raises_timeout_number(self): def test_raises_timeout_number(self):
start = time.time() start = time.time()
self.assertRaises(gevent.Timeout, self.wait, timeout=0.01) self.assertRaises(self.Timeout, self.wait, timeout=0.01)
# get raises Timeout after timeout expired # get raises Timeout after timeout expired
delay = time.time() - start delay = time.time() - start
assert 0.01 - 0.001 <= delay < 0.01 + 0.01 + 0.1, delay assert 0.01 - 0.001 <= delay < 0.01 + 0.01 + 0.1, delay
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment