Skip to content

testing

testing #

The cg_scratch pytest fixture, shipped as a pytest11 plugin.

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/recipes/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