Files
pytest2/testing/test_meta.py
Ran Benita 32bb8f3a63 Bump attrs requirement from >=17.4.0 to >=19.2.0
This allows us to remove the `ATTRS_EQ_FIELD` thing which is causing
some annoyance.
2020-09-27 13:17:59 +03:00

33 lines
796 B
Python

"""Test importing of all internal packages and modules.
This ensures all internal packages can be imported without needing the pytest
namespace being set, which is critical for the initialization of xdist.
"""
import pkgutil
import subprocess
import sys
from typing import List
import _pytest
import pytest
def _modules() -> List[str]:
pytest_pkg = _pytest.__path__ # type: str # type: ignore
return sorted(
n
for _, n, _ in pkgutil.walk_packages(pytest_pkg, prefix=_pytest.__name__ + ".")
)
@pytest.mark.slow
@pytest.mark.parametrize("module", _modules())
def test_no_warnings(module: str) -> None:
# fmt: off
subprocess.check_call((
sys.executable,
"-W", "error",
"-c", "__import__({!r})".format(module),
))
# fmt: on