Skip to content

Commit

Permalink
tests: Ignore unused Textual snapshots on 3.7
Browse files Browse the repository at this point in the history
The last version of `pytest-textual-snapshot` to support Python 3.7 uses
a different naming convention for its snapshot results than the current
version. Because of this, once our test suite is updated to use the
naming convention required by the latest version, the old version sees
all of these new snapshot result files as extra junk not being used by
the test suite, and believes they should be removed. Hack around this by
programmatically enabling Syrupy's `--snapshot-warn-unused` option for
Python 3.7.

Signed-off-by: Matt Wozniski <[email protected]>
  • Loading branch information
godlygeek authored and pablogsal committed Jul 26, 2024
1 parent f6e4039 commit fc06d9d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import socket
import sys

import pytest

Expand All @@ -10,3 +11,9 @@ def free_port():
port_number = s.getsockname()[1]
s.close()
return port_number


if sys.version_info < (3, 8):
# Ignore unused Textual snapshots on Python 3.7
def pytest_configure(config):
config.option.warn_unused_snapshots = True

0 comments on commit fc06d9d

Please sign in to comment.