-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanismtype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Got stuck on this for a bit while I was testing an object I wrote which implemented __getattr__
-- i'd forgotten to raise an AttributeError
if I couldn't fetch the given attribute.
If you do an assertion like this with the property access directly in the assertion statement, pytest does a call to object.__name__
to try and make a nicer assertion message, and when my __getattr__
fails the stack trace ends up in the test error message, even though it wasn't the reason for the test to fail.
I've written a test and identified a fix: #4632
nicoddemusnicoddemus
Metadata
Metadata
Assignees
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanismtype: bugproblem that needs to be addressedproblem that needs to be addressed