API Reference¶
Run one test suite against several interchangeable backends.
- pytest_multi_backend.backend_fixture(*, name: str, backends: Sequence[Enum], setup_for: Callable[[...], Generator[None]]) FixtureFunctionDefinition¶
Make a fixture which runs each test once per backend.
A test which uses the fixture runs once against each backend, with the backend’s ID in the test’s ID. Giving
--skip-backendthebackend_option_name()of a backend skips, rather than deselects, each test against that backend, so that a run which skips a backend still reports the tests which would have used it.- Parameters:
name¶ – The name which tests use to request the fixture.
backends¶ – The backends to run each test against.
setup_for¶ – A generator function which is called with the keyword arguments
backendandrequest. It sets that backend up, yields once while the test runs, and then tears it down. Anything else it needs comes fromgetfixturevalue(), because a fixture made here requests no fixtures butrequest.
- Returns:
A fixture which yields the backend which the test is running against. Assign it to a module-level name in a
conftest.pyor a plugin module forpytestto find it.