Documentation
Documentation
API Reference
API Reference
cauldron.steptest.create_test_fixture()
Creates a pytest fixture for step testing within the current project.
Path to the test file being executed, usually __file__
.
Name of the fixture to use as the argument in tests. By default
this will be tester
.
A pytest fixture that will be scoped to the test module in which
it has been created.
Basic Usage
The example below shows how to create and use a test fixture.
from cauldron import steptest
test_fixture = steptest.create_test_fixture(__file__)
def test_notebook_step(tester: steptest.CauldronTest):
"""Should run notebook step without error."""
tester.run_step('S01-Load-Data.py')
By default the name of the fixture within tests will be called "tester". However,
that can be changed to whatever you want it to be by specifying the fixture_name
argument when creating the fixture. The above example with a custom fixture name
would look like:
from cauldron import steptest
test_fixture = steptest.create_test_fixture(__file__, fixture_name='foo')
def test_notebook_step(foo: steptest.CauldronTest):
"""Should run notebook step without error."""
foo.run_step('S01-Load-Data.py')