-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: add support for custom snapshot names, close #555 #563
Conversation
The snapshot_name_suffix will hold an optional suffix to be used instead of index in the snapshot_name. teh suffix will be default be formatted to be between brackets: "[<snapshot_name_suffix>]"
The snapshot_name_suffix will be used instead of index if it is provided
Update type of snapshot_name_suffix from str to Optional[str] Co-authored-by: Noah <[email protected]>
…_name_suffix is resolved when it is called as property of SnapshotAssertion and keeps teh same convention as before
Codecov Report
@@ Coverage Diff @@
## master #563 +/- ##
==========================================
- Coverage 99.91% 99.64% -0.27%
==========================================
Files 19 19
Lines 1130 1142 +12
==========================================
+ Hits 1129 1138 +9
- Misses 1 4 +3 |
Nice! This looks similar to stuff I had to do here https://github.com/tophat/syrupy/pull/526/files, can rebase after this gets merged in |
What's left on this PR: we need to address #561 (comment) |
For context: had to wrap the custom name in square brackets to prevent the "cannot relate snapshot name" warning. Reason this works is because https://github.com/tophat/syrupy/blob/818d405a85c2f1f5db9d673e632677c10cb52ad9/src/syrupy/location.py#L67 stops reading the name at the first non-valid python id character, which would be In the next major version of syrupy, I'd propose including the index in the snapshot itself, separate from the snapshot name so we can better differentiate the two. |
@all-contributors add bendidi for code |
I've put up a pull request to add @Bendidi! 🎉 |
🎉 This PR is included in version 1.5.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Description
Based on #561.
Related Issues