The scratch's pytest fixtures, shipped as a pytest11 plugin.
No test reaches the machine's shared scratch: every test runs with
CG_SCRATCH pointed into its own tmp_path, and cg_scratch hands a
test an isolated scratch that is active for the test and then gone.
cg_scratch(tmp_path)
An isolated scratch under tmp_path, active for the test and then gone.
Yields:
| Type |
Description |
Scratch
|
The active scratch handle for the duration of the test.
|
Source code in capturegraph-lib/capturegraph/scratch/testing.py
| @pytest.fixture
def cg_scratch(tmp_path: Path) -> Iterator[Scratch]:
"""An isolated scratch under ``tmp_path``, active for the test and then gone.
Yields:
The active scratch handle for the duration of the test.
"""
with temporary(tmp_path / ".cg-scratch") as scratch:
yield scratch
|