You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable the pytest plugin from pytest's own config, not only an env var #339
The pytest plugin's only switch is an environment variable. _opted_in() reads DEVTOOLS_ENABLE/DEVTOOLS_PORT, trace mode reads DEVTOOLS_TRACE, and the
plugin registers no pytest_addoption at all — so there is no way to turn
capture on from the project itself:
DEVTOOLS_ENABLE=1 DEVTOOLS_TRACE=1 pytest # the only way today
Every pytest plugin offers CLI flags and ini options; an env var is the
fallback for CI, not the interface. It is undiscoverable (pytest --help shows
nothing), uncommittable, and per-shell rather than per-project — a contributor
who clones the repo has no way to see that capture exists.
The opt-in itself is not the problem and must stay. The plugin auto-loads
through an entry point, so installing the package must never change how an
existing suite behaves. A CLI flag or an ini option is equally explicit and
strictly better.
Plain scripts already need none of this — devtools.enable(trace=True) is
configured entirely in code, and DEVTOOLS_ENABLE is not consulted for them.
Only the pytest surface is affected.
Worth doing before the first PyPI publish (#294). Changing how capture is
switched on after release is a breaking change for anyone already set up.
Acceptance criteria
pytest --devtools and a [tool.pytest.ini_options] entry each enable capture
with no environment variable, and the same for trace mode. Precedence is CLI →
ini → env. The existing environment variables keep working: CI and the pnpm demo:python:* scripts use them, and removing them would break setups
that already exist.
Activity