-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Reusing snapshot with different values that match dirty-equals causes tests to fail when fixing #112
Comments
Thank you for the report.
You are right. The new value should pass all comparisons. There is no helpful error message because I have to disable pytest-assert-rewriting because I need executing to fix the bugs. But the actual problem is that the first value "a" is not equal to "b" in the second iteration. This should be fixable. |
@alexmojaki, you can try this branch #114 and this samuelcolvin/dirty-equals#105. |
This is not urgent, I'll wait for the release. Thanks for your quick response! |
fixed in 0.13.2 |
As a simple example, this test passes normally but fails with
--inline-snapshot=fix
:I assume this is because
snapshot
expects its contents to be the same in eachassert ... == snapshot(...)
. There's no helpful error message, justAssertionError
.As a more practical example, this test fails when fixing:
https://github.com/pydantic/logfire/blob/3c521842496dd110357c086abff8930cb9b446e2/tests/test_cli.py#L221-L222
The
parametrize
causes the test to run twice, so thesnapshot
which is in the same place is expected to contain the same thing, even though there's no loops. But its exact contents depend on the value oftmp_path
which changes each time. TheIsStr(regex=r'^\(file=.*')
is supposed to make this not matter.The text was updated successfully, but these errors were encountered: