tools.test_runner

class openfisca_core.tools.test_runner.ErrorMargin(__root__)[source]
class openfisca_core.tools.test_runner.Options[source]
class openfisca_core.tools.test_runner.Test(absolute_error_margin, relative_error_margin, name='', input=<factory>, output=None, period=None, reforms=<factory>, keywords=None, extensions=<factory>, description=None, max_spiral_loops=None)[source]
class openfisca_core.tools.test_runner.YamlFile(*, tax_benefit_system, options, **kwargs)[source]
collect()[source]

Collect children (items and collectors) for this collector.

config: Config

The pytest config object.

name: str

A unique name within the scope of the parent node.

parent

The parent collector node.

path: pathlib.Path

Filesystem path where this node was collected from (can be None).

session: Session

The pytest session this node is part of.

openfisca_core.tools.test_runner.run_tests(tax_benefit_system, paths, options={})[source]

Runs all the YAML tests contained in a file or a directory.

If path is a directory, subdirectories will be recursively explored.

Parameters:
  • tax_benefit_system (TaxBenefitSystem) – the tax-benefit system to use to run the tests.

  • paths (str | Sequence[str]) – A path, or a list of paths, towards the files or directories containing the tests to run. If a path is a directory, subdirectories will be recursively explored.

  • options (Options) – See more details below.

Returns:

The number of successful tests executed.

Raises:

:exc:`AssertionError` – if a test does not pass.

Return type:

int

Testing options:

Key

Type

Role

verbose

bool

See openfisca test options doc

name_filter

str

Tests can also be run in the console with openfisca test.