Skip to content

Commit 2ceec37

Browse files
committed
Move warning suppression to pytest.ini so it occurs after 'error'.
1 parent 65fab2f commit 2ceec37

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

conftest.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import sys
2-
import warnings
32

43

54
pytest_plugins = 'setuptools.tests.fixtures'
@@ -28,24 +27,3 @@ def pytest_addoption(parser):
2827
if sys.version_info < (3, 6):
2928
collect_ignore.append('docs/conf.py') # uses f-strings
3029
collect_ignore.append('pavement.py')
31-
32-
33-
if sys.version_info > (3, 10):
34-
# https://github.com/pypa/setuptools/pull/2865#issuecomment-965700112
35-
warnings.filterwarnings(
36-
'ignore',
37-
'The distutils.sysconfig module is deprecated, use sysconfig instead',
38-
)
39-
40-
41-
is_pypy = '__pypy__' in sys.builtin_module_names
42-
if is_pypy:
43-
# Workaround for pypa/setuptools#2868
44-
warnings.filterwarnings(
45-
'ignore',
46-
'Distutils was imported before setuptools',
47-
)
48-
warnings.filterwarnings(
49-
'ignore',
50-
'Setuptools is replacing distutils',
51-
)

pytest.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,15 @@ filterwarnings=
3434

3535
# https://github.com/pypa/setuptools/issues/2497
3636
ignore:.* is an invalid version and will not be supported::pkg_resources
37+
38+
# https://github.com/pypa/setuptools/pull/2865#issuecomment-965700112
39+
# ideally would apply to Python 3.10+ when
40+
# SETUPTOOLS_USE_DISTUTILS=stdlib but for
41+
# https://github.com/pytest-dev/pytest/discussions/9296
42+
ignore:The distutils.sysconfig module is deprecated, use sysconfig instead
43+
44+
# Workaround for pypa/setuptools#2868
45+
# ideally would apply to PyPy only but for
46+
# https://github.com/pytest-dev/pytest/discussions/9296
47+
ignore:Distutils was imported before setuptools
48+
ignore:Setuptools is replacing distutils

0 commit comments

Comments
 (0)