-
-
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
Incorrect introspection for MagicMock.assert_has_calls #234
Comments
'pytest introspection follows" doesn't appear in our codebase, this must be something from a faulty plugin -- appears to be pytest-mock |
Hi @progval, Indeed this is a bug in the introspection done by The problem seems to be how the internal pytest-mock/src/pytest_mock/plugin.py Lines 442 to 444 in be33132
I probably won't get to this any time soon, but others feel free to give it a shot. 👍 cc @asfaltboy |
Ran into the same error today too! The |
Me too! with |
I created this PR #359 |
Hi,
I wrote a test that calls a MagicMock() with a list of bytes, then uses assert_has_calls with a different argument (list of strings).
Here is pytest's output:
The first line of the error(
AssertionError
) is correct, but the other ones aren't:('foo', [b'baz']) == ([call('foo', ['bar']), call('foo', ['baz'])],)
is not exactly what was asserted; instead the assertion was that the left side is inside the right side's first elementassert {} == {'any_order': True}
this is not part of the assertion,any_order
is just an argument of the functionInstead, I would probably expect something like this:
OS: Debian 10
Python version: 3.7.3
pytest version: 6.2.2
pip list
Thanks!
The text was updated successfully, but these errors were encountered: