Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open_tcp_listeners exception __cause__ is always an ExceptionGroup #2900

Merged
merged 2 commits into from
Dec 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/trio/_tests/test_highlevel_open_tcp_listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,12 @@ async def test_open_tcp_listeners_some_address_families_unavailable(
with pytest.raises(OSError, match="This system doesn't support") as exc_info:
await open_tcp_listeners(80, host="example.org")

if isinstance(exc_info.value.__cause__, BaseExceptionGroup):
for subexc in exc_info.value.__cause__.exceptions:
assert "nope" in str(subexc)
else:
assert isinstance(exc_info.value.__cause__, OSError)
assert "nope" in str(exc_info.value.__cause__)
# open_listeners always creates an exceptiongroup with the
# unsupported address families, regardless of the value of
# strict_exception_groups or number of unsupported families.
assert isinstance(exc_info.value.__cause__, BaseExceptionGroup)
for subexc in exc_info.value.__cause__.exceptions:
assert "nope" in str(subexc)
else:
listeners = await open_tcp_listeners(80)
for listener in listeners:
Expand Down