Skip to content
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

Syrupy is recognizing snapshot as not being used (4.0.1) #717

Closed
abdulhaq-e opened this issue Mar 3, 2023 · 3 comments · Fixed by #761
Closed

Syrupy is recognizing snapshot as not being used (4.0.1) #717

abdulhaq-e opened this issue Mar 3, 2023 · 3 comments · Fixed by #761
Labels
bug Something isn't working good first issue Good for newcomers regression released

Comments

@abdulhaq-e
Copy link

abdulhaq-e commented Mar 3, 2023

Describe the bug

This is probably a regression in the latest release. I didn't observe the behavior in 4.0.0:

  1. On a new test with no snapshot (using the json extension), I get the expected behaviour:

1 snapshot failed
Snapshot 'TestFoo.test_foo' does not exist!

  1. With the first pytest --snapshot-update (this is where the first signs of the bug is):

1 snapshot generated. 1 unused snapshot deleted.
Deleted TestFoo (tests/foo/snapshots/test_foo/TestFoo.test_foo.json)

Why does it output Deleted ...., that isn't the expected behaviour (the deletion doesn't happen though)
3. Another follow up when running pytest:

1 snapshot passed. 1 snapshot unused.
Re-run pytest with --snapshot-update to delete unused snapshots.

Again, that isn't correct. It gets worse though:
4. pytest --snapshot-update:
This time the deletion will happen hence the next run of pytest will fail since it won't find a snapshot.

Env:

Syrupy 4.0.1
Python 3.10

Going back to 4.0.0 solved the issue.

@abdulhaq-e
Copy link
Author

If I have time in the weekend I will have a look at this. I can only see 1 or 2 commits that change logic in between 4.0.0 and 4.0.1

@noahnu noahnu added bug Something isn't working regression labels Mar 3, 2023
@noahnu
Copy link
Collaborator

noahnu commented Mar 3, 2023

#710 is the only change in 4.0.1.

@noahnu noahnu added the good first issue Good for newcomers label Apr 4, 2023
tophat-opensource-bot pushed a commit that referenced this issue Jun 19, 2023
## [4.0.4](v4.0.3...v4.0.4) (2023-06-19)

### Bug Fixes

* incorrect marking of TestClass.test_method as unused, close [#717](#717) ([#761](#761)) ([0badfdb](0badfdb))
@tophat-opensource-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 4.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers regression released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants