-
Notifications
You must be signed in to change notification settings - Fork 40
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
Overwriting dirname causes test suite not to fail if snapshots unused #868
Comments
Ah this is an old issue. I'd definitely like to fix this. I think this should be doable by updating the syrupy/src/syrupy/extensions/base.py Line 117 in d3f891e
For reference, the Line 40 in 64b4265
|
I've never contributed here before. Would be willing to pick it up. |
That'd be great! Let me know if you have any questions |
I wonder if we need the Because, in for filepath in walk_snapshot_dir(self.dirname(test_location=test_location)): So every file that we find in this walk, is always within the I removed this check and all tests passed expect What do you think? |
I also tested this using the default snapshots dir and tests do not fail when I added a fake entry |
Hmm, yeah I think it can be removed. Feel free to put up a pull request that removes it and updates the test case. I'd also add a test case that covers what @joostlek posted in the original post |
Any progress on this? I also wanted to look into the issue, so if I can pick it up, feel free to let me know :) |
You can pick up! |
Do you have a branch somewhere with what you have? |
The only change I made in the code was removing the check if file is inside SNAPSHOT_DIRNAME (which is a constant with the default dirname). I concluded this check is not needed. I was then not able to replicate the issue you had after changing that.
|
🎉 This issue has been resolved in version 4.7.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Describe the bug
Within Home Assistant we have a SnapshotExtension to overwrite the default
__snapshots__
dir name withsnapshots
. But today I actually noticed that this had the side effect that it doesn't fail the test suite if there are unused snapshots in the snapshots folder.To reproduce
Add the SnapshotExtension. Have it generate a snapshot. Add a fake entry to the snapshot. Run the test suite.
Expected behavior
I'd expect it to fail the test suite because there are entries that are not found. I can imagine that we have quite a basic way of overwriting the directory and can imagine people with way more interesting setups for the snapshots which would probably break with the expected behaviour. So I would not be surprised if the failure is turned off when the dirname is overwritten, but I'd then at least expect to read something in a docstring or in the docs.
Screenshots
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: