File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -688,3 +688,29 @@ def fut_cb(fut):
688
688
fut .add_done_callback (fut_cb )
689
689
loop .add_writer (fd , writer_cb , fut )
690
690
loop .run_until_complete (cb_called )
691
+
692
+
693
+ def test_exception_handler (application ):
694
+ handler_called = False
695
+ coro_run = False
696
+ loop = quamash .QEventLoop (application )
697
+ asyncio .set_event_loop (loop )
698
+
699
+ @asyncio .coroutine
700
+ def future_except ():
701
+ nonlocal coro_run
702
+ coro_run = True
703
+ raise ExceptionTester ()
704
+
705
+ def exct_handler (loop , data ):
706
+ nonlocal handler_called
707
+ handler_called = True
708
+
709
+ try :
710
+ loop .set_exception_handler (exct_handler )
711
+ asyncio .async (future_except ())
712
+ loop .run_until_complete (asyncio .sleep (.1 ))
713
+ finally :
714
+ asyncio .set_event_loop (None )
715
+ assert coro_run
716
+ assert handler_called
You can’t perform that action at this time.
0 commit comments