From 9a56d441b3865b74d364410addd1f8c3e01ffb26 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 3 Feb 2020 14:20:55 +0100 Subject: [PATCH] testing/test_meta.py: parametrize with TYPE_CHECKING Ref: https://github.com/pytest-dev/pytest/pull/6665 --- testing/test_meta.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/testing/test_meta.py b/testing/test_meta.py index 296aa42aaac..09b96e2b8ee 100644 --- a/testing/test_meta.py +++ b/testing/test_meta.py @@ -16,14 +16,19 @@ def _modules(): @pytest.mark.slow +@pytest.mark.parametrize("type_checking", (0, 1)) @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 +def test_no_warnings(module, type_checking): + 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 typing; typing.TYPE_CHECKING = True;" if type_checking else "") + + "import {}".format(module), + ) + )