class
CauldronTest
cauldron.steptest.CauldronTest

A Dependency injection class for use with Pytest or similar testing framework.

info_outline
This class isn't meant to be instantiated outside of a pytest fixture. Instead it is exposed for usage documentation within pytest fixtures and for typing.
Methods
def
run_step

Runs the specified step by name its complete filename including extension

Arguments
Required
Optional
step_name

str

The full filename of the step to be run including its extension.

allow_failure

bool

Whether or not to allow a failed result to be returned. If False, a failed attempt to run a step will cause the current test to fail immediately before returning a value from this function call. Override this with a True value to have the step failure data passed back for inspection.

Default Value: 

False

Returns

StepTestRunResult

A StepTestRunResult instance containing information about the execution of the step.

Basic Usage
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
import cauldron as cd import pandas as pd from cauldron import steptest test_fixture = steptest.create_test_fixture(__file__) def test_missing_column(tester: steptest.CauldronTest): """ should not fail if the data frame is missing the "b" column """ # Create a test data frame that has an "a" column but no "b" column cd.shared.df = pd.DataFrame(dict(a=[12, 24, 36])) # Run the step result = tester.run_step("S02-Merge-Columns.py") # Validate that the step ran successfully assert result.success