-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Cannot rewrite assertions? #12699
-
Hello, for some reason I cannot seem to use the def pytest_assertrepr_compare(op, left, right):
print(op, left, right)
return [
"Comparing Foo instances:",
f" vals: {left} != {True}",
] My [tool.pyproject.ini_options]
addopts = "--import-mode=importlib" # taking this out seems to work somehow? And finally, my test def test_something():
foo = [1, 2]
bar = {3, 4}
assert foo == bar I'm not using any plugins except for xdist (but I'm only running this one test), any ideas on how to make it reproducible? Log
I feel like it might be one of my dependencies, but none of them seem to be the cause of it... |
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 4 comments · 1 reply
-
It looks like the config parameter is missing in the signature (although I don’t think that’s the reason) You can check the debug output of the pytest: PYTEST_DEBUG=1 pytest |
Beta Was this translation helpful? Give feedback.
All reactions
-
I tried it with and without the config parameter, it didn't make a difference
|
Beta Was this translation helpful? Give feedback.
All reactions
-
What is your directory structure in the project (the minimum for which the problem can be reproduced)? |
Beta Was this translation helpful? Give feedback.
All reactions
-
It looks somewhat similar to #12659. This issue has been fixed. |
Beta Was this translation helpful? Give feedback.
All reactions
-
Yes it seems to work! Kudos to him for being able to create an MRE :) |
Beta Was this translation helpful? Give feedback.
It looks somewhat similar to #12659. This issue has been fixed.
Can you try again using the
main
branch pytest in the repository?