Skip to content

Commit

Permalink
fix test on non-strict
Browse files Browse the repository at this point in the history
  • Loading branch information
jakkdl committed Oct 20, 2024
1 parent 77e5779 commit df0f56d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,19 @@ async def handler(request):
except TypeError:
raise e_primary from e_cause
e = exc_info.value
# a copy is reraised
assert e is not e_primary
assert e.__cause__ is e_cause

# the nursery-internal group is injected as context
assert isinstance(e.__context__, ExceptionGroup)
assert e.__context__.exceptions[0] is e_primary
assert e.__context__.exceptions[0].__context__ is e_context
if _trio_default_non_strict_exception_groups():
assert e is e_primary
assert e.__cause__ is e_cause
assert e.__context__ is e_context
else:
# a copy is reraised to avoid losing e_context
assert e is not e_primary
assert e.__cause__ is e_cause

# the nursery-internal group is injected as context
assert isinstance(e.__context__, ExceptionGroup)
assert e.__context__.exceptions[0] is e_primary
assert e.__context__.exceptions[0].__context__ is e_context

@fail_after(1)
async def test_reject_handshake(nursery):
Expand Down

0 comments on commit df0f56d

Please sign in to comment.