pytest_experiments.experiment module

class Experiment(request: _pytest.fixtures.FixtureRequest)[source]

Bases: object

finish()[source]

Post process the experiment and save to the database.

get_reports() dict[source]

Returns the reports dict if it exists.

The reports dict is populated by our custom hook and is only available after the test has run.

property name: str

The full qualified name of the test.

property parameters: dict

The input parameters of the test.

This will contain the closure of inputs supplied to the test, some of which we do not care about.

post_process()[source]

Inspect the context for test outcome.

The method may only be run after the test has completed.

record(**kwargs)[source]

Record data about this experiment.

As this data will be serialized as JSON, keys must be strings. This is enforced by the stricter requirement that keys be valid python identifiers.

save()[source]

Save this experiment to the database.

property test_fn: _pytest.python.Function

The test function.

to_model() pytest_experiments.store.ExperimentModel[source]

Render the experiment into its database model.

exception ExperimentError[source]

Bases: pytest_experiments.common.PytestExperimentsError

experiments_db_uri(request: _pytest.fixtures.FixtureRequest) str[source]

Retrieve the URI of the database used to store experiment results.

to_experiment_outcome(reports: dict) pytest_experiments.common.ExperimentOutcome[source]

Return an ExperimentOutcome from the pytest reports