Skip to content

Commit

Permalink
Fail when new snapshots are added and not updated
Browse files Browse the repository at this point in the history
See upstream:

syrusakbary#73

If not configured to update the tests, fail when new tests are added.
  • Loading branch information
noahp committed Sep 12, 2022
1 parent 48528b7 commit 35b4aea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion snapshottest/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ def assert_match(self, value, name=""):
try:
prev_snapshot = self.module[self.test_name]
except SnapshotNotFound:
self.store(value) # first time this test has been seen
if self.update:
self.store(value) # first time this test has been seen
else:
raise
else:
try:
self.assert_value_matches_snapshot(value, prev_snapshot)
Expand Down

0 comments on commit 35b4aea

Please sign in to comment.