Skip to content

Commit

Permalink
Adjust wait condition in test
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickinson committed Mar 26, 2024
1 parent 9148d03 commit cc9127c
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions traits/observation/tests/test_observe.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,17 +690,15 @@ async def test_async_dispatch_error(self):

async def handler(event):
raise Exception("Bad handler")
event.set()

def exception_handler(loop, context):
exceptions.append(context["exception"].args[0])
event.set()

with self.asyncio_exception_handler(exception_handler):
with self.assertRaises(asyncio.exceptions.TimeoutError):
dispatch_same(handler, event)
await asyncio.wait_for(event.wait(), timeout=0.1)
dispatch_same(handler, event)
await asyncio.wait_for(event.wait(), timeout=10.0)

self.assertFalse(event.is_set())
self.assertEqual(exceptions, ["Bad handler"])

def test_async_dispatch_no_loop(self):
Expand Down

0 comments on commit cc9127c

Please sign in to comment.