Fixtures¶
The purpose of test fixtures is to ease the writing of test functions by providing informations and data automatically. You may find more documentation on pytest fixture in its official documentation. We describe here the fixtures defined in pytest-executable. They are used in the default test module, give a look at it for usage examples, see Builtin test module.
Runner fixture¶
This fixture is used to run executable, it will do the following:
get the runner script passed to the pytest command line option
--runner
,process it to replace the placeholders {{nproc}} and {{output_path}} with their actual values,
write it to the
run_executable.sh
shell script in the test case output directory.
The runner
object provided by the fixture can be executed with the
run()
method which will return the exit status of the script
execution. The value 0 of the exit status means a successful execution.
Output path fixture¶
This fixture is used to get the absolute path to the output directory of a test
case. It provides the output_path
variable that holds a Path
object.
Tolerances fixture¶
This fixture is used to get the values of the tolerances defined in the test_case.yaml
.
It provides the tolerances
dictionary that binds the name of a
quantity to an object that has 2 attributes:
rel
: the relative tolerance,abs
: the absolute tolerance.
Regression path fixture¶
This fixture is used to get the absolute path to the directory that contains
the regression reference of a test case when the command line option
--regression-root
is used. It provides the regression_path
variable that holds a Path object.
You may use this fixture with the output_path
fixture to get the
path to the file that shall be compared to a reference file.