-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Behavior of spy on class attributes #397
Comments
Hi, We use pytest-mock/src/pytest_mock/plugin.py Line 178 in 1ff80b2
|
Hi,
while spy will throw an Error. Just thought the behavior was kind of weird. By the way, the reason it throws an error is because of the first line of the spy method:
Thought maybe you could treat attributes / properties somewhat differently and at the same time solve this issue for example: #35 Let me know what you think, cheers. |
I was playing around with the spy feature and realized it will happily create a spy object when referencing a class attribute:
However, if I change the line
to something like
It will of course complain that MyClass doesn't have an attribute "not_an_attribute".
It seems a bit odd to me that the case above won't raise an Exception or a Warning, given that spy is supposed to be used for methods and functions. Would like to know what you think.
The text was updated successfully, but these errors were encountered: