Skip to content

Commit

Permalink
Fix test_no_warnings to handle e.g. _pytest.async (#7044)
Browse files Browse the repository at this point in the history
Before this patch it would result in a SyntaxError with e.g. `import _pytest.async`.
  • Loading branch information
blueyed committed Apr 9, 2020
1 parent 413ca8a commit f136b79
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions testing/test_meta.py
Expand Up @@ -7,29 +7,29 @@
import pkgutil
import subprocess
import sys
from typing import List

import _pytest
import pytest


def _modules():
def _modules() -> List[str]:
pytest_pkg = _pytest.__path__ # type: str # type: ignore
return sorted(
n
for _, n, _ in pkgutil.walk_packages(
_pytest.__path__, prefix=_pytest.__name__ + "."
)
for _, n, _ in pkgutil.walk_packages(pytest_pkg, prefix=_pytest.__name__ + ".")
)


@pytest.mark.slow
@pytest.mark.parametrize("module", _modules())
def test_no_warnings(module):
def test_no_warnings(module: str) -> None:
# 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),
"-c", "__import__({!r})".format(module),
))
# fmt: on

0 comments on commit f136b79

Please sign in to comment.