Closed
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