Skip to content

Commit dbb189d

Browse files
Mark HarvistonMark Harviston
Mark Harviston
authored and
Mark Harviston
committed
test for #34 reproduced
1 parent 0388300 commit dbb189d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_qeventloop.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,3 +688,29 @@ def fut_cb(fut):
688688
fut.add_done_callback(fut_cb)
689689
loop.add_writer(fd, writer_cb, fut)
690690
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

0 commit comments

Comments
 (0)