test_ok2/testing/test_meta.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
781 B
Python
Raw Normal View History

"""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]:
2020-10-06 09:13:05 +08:00
pytest_pkg: str = _pytest.__path__ # 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",
2020-10-03 04:16:22 +08:00
"-c", f"__import__({module!r})",
))
# fmt: on