From eaa05531eddd70ef30ad0771c98bb47cfa6fc710 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Tue, 1 Oct 2019 13:24:23 -0700 Subject: [PATCH] Add test to ensure _pytest is warning-clean on import --- testing/test_meta.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 testing/test_meta.py diff --git a/testing/test_meta.py b/testing/test_meta.py new file mode 100644 index 000000000..7aa100e6e --- /dev/null +++ b/testing/test_meta.py @@ -0,0 +1,28 @@ +import pkgutil +import subprocess +import sys + +import _pytest +import pytest + + +def _modules(): + return sorted( + n + for _, n, _ in pkgutil.walk_packages( + _pytest.__path__, prefix=_pytest.__name__ + "." + ) + ) + + +@pytest.mark.parametrize("module", _modules()) +def test_no_warnings(module): + # fmt: off + subprocess.check_call(( + sys.executable, + "-W", "error", + # https://github.com/pytest-dev/pytest/issues/5901 + "-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 + "-c", "import {}".format(module), + )) + # fmt: on