stricttest v0.2.0 /python.src.stricttest.envfloor
On this page

The always-on env-poisoning floor: throwaway HOME and XDG dirs, a throwaway git identity and config, transport lockdown, and credential stripping.

#python.src.stricttest.envfloor

#python.src.stricttest.envfloor

The always-on env-poisoning floor.

Installed once per process before any conftest module is imported, so it binds before a test body, a fixture, or even a module-level constant can read the real environment. os.environ is mutated directly rather than through monkeypatch because the floor is session-wide and must outlive every individual test.

Extracted verbatim-in-behavior from rlsbl's test suite, with the repo-specific constants moved into :mod:stricttest.config.

#session_env_dir

python
def session_env_dir() -> Path | None

The throwaway env directory for this process, or None if not installed.

#_preserve_toolchain_vars

python
def _preserve_toolchain_vars(settings: Settings, real_home: str) -> None

Pin the opted-in toolchain caches BEFORE HOME is repointed.

Every one of these defaults to a location under the real HOME; a throwaway HOME would send the toolchain into a cold rebuild (Go), or hide an importable module that a spawned system-python needs (PYTHONUSERBASE). They hold packages and build artifacts, not secrets -- which is why the enum is closed and why membership is opt-in per repo.

#install

python
def install(settings: Settings) -> None

Install the env-poisoning floor for this process (idempotent).

#uninstall

python
def uninstall() -> None

Tear down the throwaway env directory for this process.

Search