respy.conftest#

This module includes code to configure pytest.

Module Contents#

Functions#

_fresh_directory(tmp_path)

Each test is executed in a fresh directory.

_patch_doctest_namespace(doctest_namespace)

Patch the namespace for doctests.

seed()

Create placeholder value for function argument seed to be overwritten.

pytest_addoption(parser)

Add a custom option to the pytest call.

pytest_generate_tests(metafunc)

Re-run some tests with different seeds by incrementing the base seed.

respy.conftest._fresh_directory(tmp_path)[source]#

Each test is executed in a fresh directory.

respy.conftest._patch_doctest_namespace(doctest_namespace)[source]#

Patch the namespace for doctests.

This function adds some packages to namespace of every doctest.

respy.conftest.seed()[source]#

Create placeholder value for function argument seed to be overwritten.

respy.conftest.pytest_addoption(parser)[source]#

Add a custom option to the pytest call.

Simply use

$ pytest --n-random-tests=n

to restrict running each random test with n increments of the base seed given by pytest-randomly.

respy.conftest.pytest_generate_tests(metafunc)[source]#

Re-run some tests with different seeds by incrementing the base seed.

The base seed is given by pytest-randomly in each session derived from the timestamp. You can use five as the seed value with

$ pytest --randomly-seed=5

Then, tests with certain parameter names are parameterized with incremented seed values (5, 6, 7, 8, …). Existing parameterizations are extended.