From 7ee121aeaf5db5e1dd2077321776a013d44d3fc7 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 14 Oct 2021 12:12:13 -0400 Subject: [PATCH] Try to handle variable windows errors --- tests/test_cancellation.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_cancellation.py b/tests/test_cancellation.py index 5da87ce..4271d8f 100644 --- a/tests/test_cancellation.py +++ b/tests/test_cancellation.py @@ -365,7 +365,8 @@ async def test_nested_multierrors(loglevel, start_method): # to happen before an actor is spawned if isinstance(subexc, trio.Cancelled): continue - else: + + elif isinstance(subexc, tractor.RemoteActorError): # on windows it seems we can't exactly be sure wtf # will happen.. assert subexc.type in ( @@ -373,6 +374,14 @@ async def test_nested_multierrors(loglevel, start_method): trio.Cancelled, trio.MultiError ) + + elif isinstance(subexc, trio.MultiError): + for subsub in subexc.exceptions: + assert subsub.type in ( + tractor.RemoteActorError, + trio.Cancelled, + trio.MultiError + ) else: assert isinstance(subexc, tractor.RemoteActorError) @@ -448,6 +457,7 @@ def test_cancel_via_SIGINT_other_task( with pytest.raises(KeyboardInterrupt): trio.run(main) + async def spin_for(period=3): "Sync sleep." time.sleep(period)