pytest_jsonschema_snapshot.plugin

Functions

pytest_addoption(→ None)

Adds --schema-update option to pytest.

schemashot(...)

Fixture providing a SchemaShot instance and gathering used schemas.

pytest_unconfigure(→ None)

Hook that runs after all tests have finished.

pytest_terminal_summary(→ None)

Adds a summary about schemas to the final pytest report in the terminal.

cleanup_unused_schemas(→ None)

Deletes unused schemas in update mode and collects statistics.

Module Contents

pytest_addoption(parser: pytest.Parser) None[source]

Adds –schema-update option to pytest.

schemashot(
request: pytest.FixtureRequest,
) Generator[SchemaShot, None, None][source]

Fixture providing a SchemaShot instance and gathering used schemas.

pytest_unconfigure(config: pytest.Config) None[source]

Hook that runs after all tests have finished. Clears global variables.

pytest_terminal_summary(
terminalreporter: pytest.TerminalReporter,
exitstatus: int,
) None[source]

Adds a summary about schemas to the final pytest report in the terminal.

cleanup_unused_schemas(
manager: SchemaShot,
update_mode: bool,
actions: dict[str, bool],
stats: SchemaStats | None = None,
) None[source]

Deletes unused schemas in update mode and collects statistics. Additionally, deletes the pair file <name>.json if it exists.

Parameters:
  • manager – SchemaShot instance

  • update_mode – Update mode

  • stats – Optional object for collecting statistics