diff options
author | Sergey Shepelev <temotor@gmail.com> | 2016-11-29 08:48:33 +0300 |
---|---|---|
committer | Sergey Shepelev <temotor@gmail.com> | 2020-10-19 03:10:53 +0300 |
commit | 9cc94cb26ac4fd7f9b27dc1af17af5b06f069337 (patch) | |
tree | 107439ea3eef5c7fad2822f3192493e743d0c231 | |
parent | f2ebbb87590d0fa4f173599806dfec88caeb9fb9 (diff) | |
download | eventlet-358-hub-silent-exception.tar.gz |
WIP https://github.com/eventlet/eventlet/issues/358358-hub-silent-exception
-rw-r--r-- | tests/hub_test.py | 18 | ||||
-rw-r--r-- | tests/isolated/hub_silent_exception.py | 20 |
2 files changed, 31 insertions, 7 deletions
diff --git a/tests/hub_test.py b/tests/hub_test.py index 8b9bbe9..f3e24b6 100644 --- a/tests/hub_test.py +++ b/tests/hub_test.py @@ -23,7 +23,7 @@ def noop(): class TestTimerCleanup(tests.LimitedTestCase): TEST_TIMEOUT = 2 - @skip_with_pyevent + @tests.skip_with_pyevent def test_cancel_immediate(self): hub = hubs.get_hub() stimers = hub.get_timers_count() @@ -37,7 +37,7 @@ class TestTimerCleanup(tests.LimitedTestCase): self.assert_less_than_equal(hub.get_timers_count(), 1000 + stimers) self.assert_less_than_equal(hub.timers_canceled, 1000) - @skip_with_pyevent + @tests.skip_with_pyevent def test_cancel_accumulated(self): hub = hubs.get_hub() stimers = hub.get_timers_count() @@ -54,7 +54,7 @@ class TestTimerCleanup(tests.LimitedTestCase): self.assert_less_than_equal(hub.get_timers_count(), 1000 + stimers) self.assert_less_than_equal(hub.timers_canceled, 1000) - @skip_with_pyevent + @tests.skip_with_pyevent def test_cancel_proportion(self): # if fewer than half the pending timers are canceled, it should # not clean them out @@ -194,7 +194,7 @@ class TestExceptionInMainloop(tests.LimitedTestCase): class TestExceptionInGreenthread(tests.LimitedTestCase): - @skip_unless(greenlets.preserves_excinfo) + @tests.skip_unless(greenlets.preserves_excinfo) def test_exceptionpreservation(self): # events for controlling execution order gt1event = eventlet.Event() @@ -252,7 +252,7 @@ class TestExceptionInGreenthread(tests.LimitedTestCase): class TestHubBlockingDetector(tests.LimitedTestCase): TEST_TIMEOUT = 10 - @skip_with_pyevent + @tests.skip_with_pyevent def test_block_detect(self): def look_im_blocking(): import time @@ -263,8 +263,8 @@ class TestHubBlockingDetector(tests.LimitedTestCase): self.assertRaises(RuntimeError, gt.wait) debug.hub_blocking_detection(False) - @skip_with_pyevent - @skip_if_no_itimer + @tests.skip_with_pyevent + @tests.skip_if_no_itimer def test_block_detect_with_itimer(self): def look_im_blocking(): import time @@ -402,3 +402,7 @@ def test_kqueue_unsupported(): # https://github.com/eventlet/eventlet/issues/38 # get_hub on windows broken by kqueue tests.run_isolated('hub_kqueue_unsupported.py') + + +def test_hub_silent_exception(): + tests.run_isolated('hub_silent_exception.py') diff --git a/tests/isolated/hub_silent_exception.py b/tests/isolated/hub_silent_exception.py new file mode 100644 index 0000000..c0d630a --- /dev/null +++ b/tests/isolated/hub_silent_exception.py @@ -0,0 +1,20 @@ +__test__ = False + + +class PleaseStopUsingExceptionsAsGoto(Exception): + pass + + +def fun(): + raise PleaseStopUsingExceptionsAsGoto() + + +if __name__ == '__main__': + import eventlet.debug + eventlet.debug.hub_exceptions(False) + t = eventlet.spawn(fun) + eventlet.sleep(0) + try: + t.wait() + except PleaseStopUsingExceptionsAsGoto: + print('pass') |