Skip to content

Commit eaa0553

Browse files
committed
Add test to ensure _pytest is warning-clean on import
1 parent 74aed6e commit eaa0553

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

testing/test_meta.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pkgutil
2+
import subprocess
3+
import sys
4+
5+
import _pytest
6+
import pytest
7+
8+
9+
def _modules():
10+
return sorted(
11+
n
12+
for _, n, _ in pkgutil.walk_packages(
13+
_pytest.__path__, prefix=_pytest.__name__ + "."
14+
)
15+
)
16+
17+
18+
@pytest.mark.parametrize("module", _modules())
19+
def test_no_warnings(module):
20+
# fmt: off
21+
subprocess.check_call((
22+
sys.executable,
23+
"-W", "error",
24+
# https://github.com/pytest-dev/pytest/issues/5901
25+
"-W", "ignore:The usage of `cmp` is deprecated and will be removed on or after 2021-06-01. Please use `eq` and `order` instead.:DeprecationWarning", # noqa: E501
26+
"-c", "import {}".format(module),
27+
))
28+
# fmt: on

0 commit comments

Comments
 (0)