Skip to content

Commit e0d8111

Browse files
committed
dev: Avoid pytest 7.0.0 on Python 3.9
It contains a fatal bug¹ when used on 3.9 because it incorrectly guards a 3.10-only implementation detail with a >=3.9 version check, which results in: ModuleNotFoundError: No module named 'importlib.readers' when trying to load/parse Python modules. Pytest 7.0.0 is only ~11 hours old at the moment, and another person filed the upstream bug report as I was writing my own. What a life, living on the edge. 😬 Adjusts the warnings filter slightly in pytest.ini because PytestRemovedIn8Warning is only present in pytest 7 and for now our tests on 3.9 will use pytest 6. ¹ pytest-dev/pytest#9608
1 parent f8d9bd9 commit e0d8111

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ filterwarnings =
1414
error
1515
ignore:SelectableGroups dict interface:DeprecationWarning:flake8
1616
ignore:<class 'pytest_flake8[.]Flake8Item'> is not using a cooperative constructor:pytest.PytestDeprecationWarning
17-
ignore:The .+? argument to Flake8Item is deprecated:pytest.PytestRemovedIn8Warning
17+
ignore:The .+? argument to Flake8Item is deprecated:pytest.PytestDeprecationWarning

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ def find_namespaced_packages(namespace):
122122
"flake8",
123123
"mypy",
124124
"nextstrain-sphinx-theme",
125-
"pytest",
125+
"pytest; python_version != '3.9'",
126+
"pytest !=7.0.0; python_version == '3.9'",
126127
"pytest-flake8",
127128
"recommonmark",
128129
"sphinx>=3",

0 commit comments

Comments
 (0)