diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f161578..4428edb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,9 @@ +1.0.3 (unreleased) +------------------ + +- Provide top-level ``pytest_xprocess`` module compatibility shim for downstream imports (`#163 `_) + + 1.0.1 (2024-04-31) ------------------ diff --git a/pytest_xprocess.py b/pytest_xprocess.py new file mode 100644 index 0000000..7c8d348 --- /dev/null +++ b/pytest_xprocess.py @@ -0,0 +1,29 @@ +from xprocess import ProcessStarter +from xprocess import XProcess +from xprocess import XProcessInfo +from xprocess import XProcessResources +from xprocess.pytest_xprocess import get_log_files +from xprocess.pytest_xprocess import getrootdir +from xprocess.pytest_xprocess import InterruptionHandler +from xprocess.pytest_xprocess import pytest_addoption +from xprocess.pytest_xprocess import pytest_cmdline_main +from xprocess.pytest_xprocess import pytest_configure +from xprocess.pytest_xprocess import pytest_runtest_makereport +from xprocess.pytest_xprocess import pytest_unconfigure +from xprocess.pytest_xprocess import xprocess + +__all__ = [ + "InterruptionHandler", + "ProcessStarter", + "XProcess", + "XProcessInfo", + "XProcessResources", + "get_log_files", + "getrootdir", + "pytest_addoption", + "pytest_cmdline_main", + "pytest_configure", + "pytest_runtest_makereport", + "pytest_unconfigure", + "xprocess", +] diff --git a/setup.cfg b/setup.cfg index dfb962e..4d5a25b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,6 +24,7 @@ classifiers= [options] packages = find: +py_modules = pytest_xprocess python_requires = >= 3.8 [options.packages.find] @@ -38,6 +39,7 @@ branch = true include = xprocess/xprocess.py xprocess/pytest_xprocess.py + pytest_xprocess.py [flake8] # B = bugbear diff --git a/tests/test_top_level_import.py b/tests/test_top_level_import.py new file mode 100644 index 0000000..35f8d08 --- /dev/null +++ b/tests/test_top_level_import.py @@ -0,0 +1,28 @@ +import importlib.util + +import pytest_xprocess +from pytest_xprocess import getrootdir +from pytest_xprocess import ProcessStarter +from pytest_xprocess import XProcess +from pytest_xprocess import XProcessInfo +from pytest_xprocess import XProcessResources +from xprocess import ProcessStarter as InternalProcessStarter +from xprocess import XProcess as InternalXProcess +from xprocess import XProcessInfo as InternalXProcessInfo +from xprocess import XProcessResources as InternalXProcessResources +from xprocess.pytest_xprocess import getrootdir as internal_getrootdir + + +def test_top_level_pytest_xprocess_spec(): + spec = importlib.util.find_spec("pytest_xprocess") + assert spec is not None + assert spec.origin is not None + + +def test_top_level_pytest_xprocess_exports(): + assert getrootdir is internal_getrootdir + assert ProcessStarter is InternalProcessStarter + assert XProcess is InternalXProcess + assert XProcessInfo is InternalXProcessInfo + assert XProcessResources is InternalXProcessResources + assert hasattr(pytest_xprocess, "xprocess")