eradiate.testing.fixtures.DatasetRegressionFixture#
- class eradiate.testing.fixtures.DatasetRegressionFixture(request, tmp_path, reference_dir, reference_update_dir, artefact_dir, plot, logger=<eradiate.testing.report.ReportLogger object>)#
Bases:
objectImplementation of the
dataset_regressionfixture: compare a simulation result against a stored reference dataset.Reference lookup, regeneration (
--force-regen,--regen-all) and artefact naming are delegated to pytest-regressions; the verdict itself comes from one or severalRegressionTestinstances.- check(result, test, basename)#
Compare result against the reference dataset registered under basename.
- Parameters:
result (
Dataset) – Simulation result.test (
RegressionTestor sequence ofRegressionTest) – Criterion, or criteria, the comparison must satisfy. Several tests share a single reference dataset, which is how a case comparing more than one data variable is expressed.basename (
str) – Name of the reference dataset within the reference directory, without its.ncextension. May contain forward slashes to address a subdirectory.
- Raises:
RegressionTestFailure – If any of the criteria is not met.
- reference_path(basename)#
Path of the reference dataset registered under basename, or
Noneif it does not exist.Useful to a test that must know whether a reference is available before deciding what to simulate, e.g. to render a high-sample-count reference with a different integrator.