Try to handle variable windows errors

immediate_remote_cancels
Tyler Goodlet 2021-10-14 12:12:13 -04:00
parent 9d83ef82b2
commit 7ee121aeaf
1 changed files with 11 additions and 1 deletions

View File

@ -365,7 +365,8 @@ async def test_nested_multierrors(loglevel, start_method):
# to happen before an actor is spawned # to happen before an actor is spawned
if isinstance(subexc, trio.Cancelled): if isinstance(subexc, trio.Cancelled):
continue continue
else:
elif isinstance(subexc, tractor.RemoteActorError):
# on windows it seems we can't exactly be sure wtf # on windows it seems we can't exactly be sure wtf
# will happen.. # will happen..
assert subexc.type in ( assert subexc.type in (
@ -373,6 +374,14 @@ async def test_nested_multierrors(loglevel, start_method):
trio.Cancelled, trio.Cancelled,
trio.MultiError trio.MultiError
) )
elif isinstance(subexc, trio.MultiError):
for subsub in subexc.exceptions:
assert subsub.type in (
tractor.RemoteActorError,
trio.Cancelled,
trio.MultiError
)
else: else:
assert isinstance(subexc, tractor.RemoteActorError) assert isinstance(subexc, tractor.RemoteActorError)
@ -448,6 +457,7 @@ def test_cancel_via_SIGINT_other_task(
with pytest.raises(KeyboardInterrupt): with pytest.raises(KeyboardInterrupt):
trio.run(main) trio.run(main)
async def spin_for(period=3): async def spin_for(period=3):
"Sync sleep." "Sync sleep."
time.sleep(period) time.sleep(period)