From 9e4d36bc5bc367756d4d0f9fa0ec632e36136a6c Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Thu, 25 Jul 2024 13:23:25 -0400 Subject: [PATCH] tests: Ignore unused Textual snapshots on 3.7 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 --- tests/conftest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 91f1283aa2..4c379cadba 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import socket +import sys import pytest @@ -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