Skip to content

Commit 000fd16

Browse files
author
RJ Lopez
committed
test: remove unreachable outer except in regression test
1 parent 316d6b6 commit 000fd16

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

tests/client/test_session_group.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -442,18 +442,14 @@ async def test_unreachable_streamable_http_error_is_catchable() -> None:
442442

443443
caught: BaseException | None = None
444444

445-
try:
446-
async with ClientSessionGroup() as group:
447-
try:
448-
await group.connect_to_server(server_params)
449-
except BaseException as inner:
450-
# Expected post-fix: real ConnectError lands here.
451-
caught = inner
452-
except BaseException as outer: # pragma: no cover
453-
# If we land here, the error escaped past the inner handler -- # pragma: no cover
454-
# that is the regression case (masking RuntimeError surfacing # pragma: no cover
455-
# from __aexit__ instead of the real ConnectError propagating). # pragma: no cover
456-
caught = outer # pragma: no cover
445+
async with ClientSessionGroup() as group:
446+
try:
447+
await group.connect_to_server(server_params)
448+
except BaseException as inner:
449+
# Pre-fix #915: the real ConnectError was masked by an anyio
450+
# cancel-scope RuntimeError raised during __aexit__ teardown.
451+
# Post-fix: the real exception propagates here and is catchable.
452+
caught = inner
457453

458454
assert caught is not None, (
459455
"Expected to catch a connection error against an unreachable "

0 commit comments

Comments
 (0)