From f67efb944d8b4e52ff6adaba42acc824c213d1c2 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Wed, 10 Dec 2008 16:08:18 +0600 Subject: [PATCH] added test for api.timeout: explicitly supplying _SilentException as an argument --- greentest/test__api_timeout.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/greentest/test__api_timeout.py b/greentest/test__api_timeout.py index d64f9d8..6c2e1ff 100644 --- a/greentest/test__api_timeout.py +++ b/greentest/test__api_timeout.py @@ -2,7 +2,7 @@ from __future__ import with_statement import unittest import weakref import time -from eventlet.api import sleep, timeout, TimeoutError +from eventlet.api import sleep, timeout, TimeoutError, _SilentException DELAY = 0.01 class Error(Exception): @@ -82,6 +82,19 @@ class Test(unittest.TestCase): sleep(DELAY*3) assert False, 'should not get there' + with timeout(DELAY, _SilentException()): + with timeout(DELAY*2, _SilentException()): + sleep(DELAY*3) + assert False, 'should not get there' + + # this case fails and there's no intent to fix it. + # just don't do it like that + #with timeout(DELAY, _SilentException): + # with timeout(DELAY*2, _SilentException): + # sleep(DELAY*3) + # assert False, 'should not get there' + + if __name__=='__main__': unittest.main()