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

Add reason for failed match to RaisesGroup #3145

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
12 changes: 5 additions & 7 deletions src/trio/_tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,11 @@ def lookup_symbol(symbol: str) -> dict[str, str]:
if module_name == "trio.socket" and class_name in dir(stdlib_socket):
continue

# ignore class that does dirty tricks
if class_ is trio.testing.RaisesGroup:
# Ignore classes that don't use attrs, they only define their members once
# __init__ is called (and reason they don't use attrs is because they're going
Comment on lines +321 to +322
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't classes that use __slots__ define members before __init__ as well? It's just that they wouldn't have any values.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ye I suppose __slots__ can also make this test work. Pytest seems to only use it sparingly though so don't think I will bother.

# to be reimplemented in pytest).
# I think that's why these are failing at least?
if class_ is trio.testing.RaisesGroup or class_ is trio.testing.Matcher:
continue

# dir() and inspect.getmembers doesn't display properties from the metaclass
Expand Down Expand Up @@ -458,11 +461,6 @@ def lookup_symbol(symbol: str) -> dict[str, str]:
"send_all_hook",
"wait_send_all_might_not_block_hook",
},
trio.testing.Matcher: {
"exception_type",
"match",
"check",
},
}
if tool == "mypy" and class_ in EXTRAS:
before = len(extra)
Expand Down
Loading
Loading