Skip to content

Commit

Permalink
Adjust cancelled test to expect raised overrun error
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Dec 15, 2021
1 parent 76ae792 commit 42960ee
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions tests/test_context_stream_semantics.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,33 +608,19 @@ async def main():

# 2 overrun cases and the no overrun case (which pushes right up to
# the msg limit)
if overrunner == 'caller':
if overrunner == 'caller' or 'cance' in overrunner:
with pytest.raises(tractor.RemoteActorError) as excinfo:
trio.run(main)

assert excinfo.value.type == StreamOverrun

elif 'cancel' in overrunner:
with pytest.raises(trio.MultiError) as excinfo:
trio.run(main)

multierr = excinfo.value

for exc in multierr.exceptions:
etype = type(exc)
if etype == tractor.RemoteActorError:
assert exc.type == StreamOverrun
else:
assert etype == tractor.ContextCancelled

elif overrunner == 'callee':
with pytest.raises(tractor.RemoteActorError) as excinfo:
trio.run(main)

# TODO: embedded remote errors so that we can verify the source
# error?
# the callee delivers an error which is an overrun wrapped
# in a remote actor error.
# error? the callee delivers an error which is an overrun
# wrapped in a remote actor error.
assert excinfo.value.type == tractor.RemoteActorError

else:
Expand Down

0 comments on commit 42960ee

Please sign in to comment.