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-backend the backend_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 backend and request. It sets that backend up, yields once while the test runs, and then tears it down. Anything else it needs comes from getfixturevalue(), because a fixture made here requests no fixtures but request.

Returns:

A fixture which yields the backend which the test is running against. Assign it to a module-level name in a conftest.py or a plugin module for pytest to find it.

pytest_multi_backend.backend_option_name(*, backend: Enum) str

The value which --skip-backend takes to skip a backend.

Parameters:

backend – The backend to give the value for.

Returns:

The name of the backend’s Enum member, in lower case.