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

Snapshots using JSONSnapshotExtension are deleted when they should not be #752

Closed
FRidh opened this issue Jun 1, 2023 · 1 comment · Fixed by #761
Closed

Snapshots using JSONSnapshotExtension are deleted when they should not be #752

FRidh opened this issue Jun 1, 2023 · 1 comment · Fixed by #761
Labels
bug Something isn't working released

Comments

@FRidh
Copy link

FRidh commented Jun 1, 2023

Describe the bug

I migrated from AmberSnapshotExtension to JSONSnapshotExtension. Updating after the initial conversion I get

9 snapshots generated. 9 unused snapshots deleted.

There are 9 snapshots, it regenerates all of them and then deletes them.

In another case it would delete all 9, but then recreate 1 but in not in the __snapshots__ folder directly, but in a folder __snapshots__/test_filename where test_filename is the name of the test script. The snapshot itself had the correct filename.

To reproduce

Steps to reproduce the behavior:

  1. Create tests with JSONSnapshotExtension
  2. Run pytest --snapshot-update and commit
  3. Rerun pytest --snapshot-update without actually having made any changes.
  4. Get 9 snapshots generated. 9 unused snapshots deleted. and indeed all your snapshots deleted.

Expected behavior

Not deleting snapshots that are still being used.

Screenshots

Environment (please complete the following information):

  • OS: NixOS 22.11
  • Syrupy Version: 4.0.2
  • Python Version: 3.11.3

Additional context

@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 released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants