If I have a tests folder structure like this -tests --init.py --test_main.py
And my test looks like this:
from pytest_snapshot.plugin import Snapshot
def test_my_func(snapshot: Snapshot) -> None:
output = "test output"
snapshot.assert_match(output, "testing.txt")
When I run pytest tests
the initial run fails.
Then I run pytest tests --snapshot-update
and it creates the snapshot.
Now the pytest tests
run passes.
When I remove the test_my_func()
function and I run pytest tests --snapshot-update --allow-snapshot-deletion
the snapshot does NOT get deleted.
The steps above are a minimal reproducable example of what I wanted to test. The --allow-snapshot-deletion
flag does not work as expected. According to the pytest_snapshot
documentation, it should remove the unused snapshots...
https://pypi.org/project/pytest-snapshot/
Am I doing something wrong or is the --allow-snapshot-deletion
flag not working correctly?