bundle.testing.tools.decorators

Submodules

Functions

cprofile(...)

get_cprofile_enabled(→ bool)

set_cprofile_enabled(→ None)

data(tmp_dir, ref_dir[, cprofile_folder])

Decorator for testing bundle Data model serialization and schema validation.

Package Contents

bundle.testing.tools.decorators.cprofile(expected_duration: int = EXPECTED_DURATION_NS, performance_threshold: int = PERFORMANCE_THRESHOLD_NS, cprofile_folder: pathlib.Path | None = None) collections.abc.Callable[[collections.abc.Callable[Ellipsis, Any]], collections.abc.Callable[Ellipsis, Any]][source]
bundle.testing.tools.decorators.get_cprofile_enabled() bool[source]
bundle.testing.tools.decorators.set_cprofile_enabled(value: bool) None[source]
bundle.testing.tools.decorators.data(tmp_dir: pathlib.Path, ref_dir: str | pathlib.Path, cprofile_folder: str | pathlib.Path | None = None)[source]

Decorator for testing bundle Data model serialization and schema validation.

Wraps test functions to perform round-trip dict and JSON serialization tests, and validates the model against its JSON schema. Tests are profiled using cprofile. Results and errors are logged, with provision for updating reference data.

Parameters:
  • tmp_dir (Path) – Temporary directory for test outputs.

  • ref_dir (str | Path) – Reference directory for baseline data.

  • cprofile_folder (str | Path | None) – Directory for cprofile output.

Returns:

A decorator that wraps test functions to extend their functionality

with serialization and validation tests.

Return type:

Decorator