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: object

Implementation of the dataset_regression fixture: 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 several RegressionTest instances.

check(result, test, basename)#

Compare result against the reference dataset registered under basename.

Parameters:
  • result (Dataset) – Simulation result.

  • test (RegressionTest or sequence of RegressionTest) – 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 .nc extension. 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 None if 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.