Commit bd2c5966 authored by Denis Bilenko's avatar Denis Bilenko

test__api_timeout.py: add a few new tests

parent 29c984ed
...@@ -118,13 +118,25 @@ class Test(greentest.TestCase): ...@@ -118,13 +118,25 @@ class Test(greentest.TestCase):
sleep(DELAY*3) sleep(DELAY*3)
raise AssertionError('should not get there') raise AssertionError('should not get there')
with Timeout(DELAY) as t1:
# this case fails and there's no intent to fix it. with Timeout(DELAY*2) as t2:
# just don't do it like that try:
#with Timeout(DELAY, _SilentException): sleep(DELAY*3)
# with Timeout(DELAY*2, _SilentException): except Timeout, ex:
# sleep(DELAY*3) assert ex is t1, (ex, t1)
# assert False, 'should not get there' assert not t1.pending, t1
assert t2.pending, t2
assert not t2.pending, t2
with Timeout(DELAY*2) as t1:
with Timeout(DELAY) as t2:
try:
sleep(DELAY*3)
except Timeout, ex:
assert ex is t2, (ex, t2)
assert t1.pending, t1
assert not t2.pending, t2
assert not t1.pending, t1
if __name__=='__main__': if __name__=='__main__':
......
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