Pytest env
pytest_env
What the target interpreter offers pytest, probed rather than assumed.
audit_test runs the target's pytest. Its structured result comes from a
plugin the runner ships (:mod:axm_audit._report_plugin) and injects with
-p and PYTHONPATH, so the target needs nothing but pytest itself.
Coverage is the only optional capability (pytest-cov): this module asks the
target interpreter, once per run, whether pytest and pytest-cov are importable,
so that a missing piece becomes a typed, explicit outcome instead of pytest's
opaque unrecognized arguments (exit 4).
MIN_PYTEST_VERSION = (7, 0)
module-attribute
Oldest pytest whose hooks the reporting plugin relies on.
PLUGIN_DIR = Path(__file__).resolve().parent.parent / '_report_plugin'
module-attribute
Directory put on the subprocess PYTHONPATH; it holds the plugin only.
PLUGIN_MODULE = 'axm_audit_report_plugin'
module-attribute
Name the reporting plugin is loaded under (-p).
PytestCapabilities
dataclass
What the target interpreter was found to provide.
Source code in packages/axm-audit/src/axm_audit/core/pytest_env.py
coverage_unavailable_reason
property
Why coverage cannot be measured here, or None when it can.
PytestEnvironmentError
Bases: ValueError
The target interpreter cannot run audit_test's pytest session.
interpreter is the interpreter that was asked (when known) and
missing names what it lacks: "pytest", "pytest>=X" or
"interpreter".
Source code in packages/axm-audit/src/axm_audit/core/pytest_env.py
probe_pytest(project_path, *, with_packages=None)
Probe the interpreter audit_test will use for project_path.
The probe goes through :func:run_in_project, hence through exactly the
interpreter selection the test run itself will get (declared session
runtime, worktree source environment, project .venv, uv overlay).
Raises:
| Type | Description |
|---|---|
PytestEnvironmentError
|
the interpreter cannot be run, has no pytest,
or has a pytest older than :data: |