tardisbase.testing.regression_data.regression_data module¶
- class tardisbase.testing.regression_data.regression_data.PlotDataHDF(*args, **kwargs)[source]¶
Bases:
HDFWriterMixin
A class that writes plot data to HDF5 format using the HDFWriterMixin.
Initializes PlotDataHDF with arbitrary keyword arguments, storing them as attributes and adding their names to hdf_properties.
Parameters:¶
**kwargs: Arbitrary keyword arguments representing properties to save.
- class tardisbase.testing.regression_data.regression_data.PytestWritingPlugin[source]¶
Bases:
object
- pytest_report_teststatus(report, config)[source]¶
Custom pytest hook to report test status for regression data writing.
This hook is called by pytest to determine the test outcome status and provides custom reporting for tests that have written regression data.
- Parameters:
report (pytest.TestReport) – The test report object containing information about the test execution, including any custom attributes set during the test run.
config (pytest.Config) – The pytest configuration object containing command-line options and configuration settings.
- Returns:
If the test report has a ‘written’ attribute that is True, returns a tuple containing: - outcome: “regression data written” (test outcome description) - letter: “W” (single letter representation) - word: “WRITTEN” (word representation for verbose output)
Returns None if the condition is not met, allowing other hooks or default behavior to determine the test status.
- Return type:
Notes
This hook is typically used in conjunction with pytest plugins that handle regression testing data, allowing tests to be marked as having successfully written reference data rather than just passing or failing.
- pytest_runtest_makereport(item, call)[source]¶
Custom pytest hook to handle test report generation for regression data writing.
This hook intercepts test execution and creates a custom test report when a TestWrite exception is encountered, marking the test as “written” rather than failed.
- Parameters:
item (pytest.Item) – The test item being executed.
call (pytest.CallInfo) – Information about the test call, including any exception information.
- Returns:
Returns a custom TestReport with outcome “written” if a TestWrite exception was raised, otherwise returns None to allow default report generation.
- Return type:
TestReport or None
Notes
This hook is specifically designed for regression testing workflows where tests may write reference data instead of comparing against it. When a TestWrite exception is raised, it indicates successful data writing rather than a test failure.
- class tardisbase.testing.regression_data.regression_data.RegressionData(request)[source]¶
Bases:
object
- property absolute_regression_data_dir¶
- property fname_prefix¶
- property fpath¶
- property module_name¶
- property relative_regression_data_dir¶
- sync_hdf_store(tardis_module, update_fname=True)[source]¶
Synchronizes the HDF store with the regression data.
- property test_name¶