Examples

Live demos

Bulk autodoc

fixture spf_demo_fixtures.demo_plain str
fixture[source]
fixture[source]
fixture spf_demo_fixtures.demo_plain str

Plain function-scope resource. Shows FIXTURE badge only.

fixture spf_demo_fixtures.demo_session str
session fixture[source]
session fixture[source]
fixture spf_demo_fixtures.demo_session str

Session-scoped resource. Shows SESSION + FIXTURE badges.

Note

Created once per test session and shared across all tests. Requesting this fixture does not create a new instance per test.

fixture spf_demo_fixtures.demo_module str
module fixture[source]
module fixture[source]
fixture spf_demo_fixtures.demo_module str

Module-scoped resource. Shows MODULE + FIXTURE badges.

fixture spf_demo_fixtures.demo_class str
class fixture[source]
class fixture[source]
fixture spf_demo_fixtures.demo_class str

Class-scoped resource. Shows CLASS + FIXTURE badges.

fixture spf_demo_fixtures.demo_factory type[str]
factory fixture[source]
factory fixture[source]
fixture spf_demo_fixtures.demo_factory type[str]

Return a callable (factory kind). Shows FACTORY + FIXTURE badges.

def test_example(demo_factory: type[str]) -> None:
    obj = demo_factory()
    assert obj is not None
fixture spf_demo_fixtures.demo_override_hook str
fixture[source]
fixture[source]
fixture spf_demo_fixtures.demo_override_hook str

Override hook — customise in conftest.py. Shows OVERRIDE + FIXTURE badges.

fixture spf_demo_fixtures.demo_autouse None
auto fixture[source]
auto fixture[source]
fixture spf_demo_fixtures.demo_autouse None

Autouse fixture. Shows AUTO + FIXTURE badges.

Autouse:

yes — runs automatically for every test

Note

No request needed — this fixture runs automatically for every test.

fixture spf_demo_fixtures.demo_deprecated str
fixture[source]
fixture[source]
fixture spf_demo_fixtures.demo_deprecated str

Return a value (deprecated since 1.0, replaced by demo_plain).

This fixture is documented with the deprecated RST option so the demo page can show the DEPRECATED + FIXTURE badge combination.

fixture spf_demo_fixtures.demo_session_factory type[str]
session factory fixture[source]
session factory fixture[source]
fixture spf_demo_fixtures.demo_session_factory type[str]

Session-scoped factory. Shows SESSION + FACTORY + FIXTURE badges.

Note

Created once per test session and shared across all tests. Requesting this fixture does not create a new instance per test.

def test_example(demo_session_factory: type[str]) -> None:
    obj = demo_session_factory()
    assert obj is not None
fixture spf_demo_fixtures.demo_session_autouse None
session auto fixture[source]
session auto fixture[source]
fixture spf_demo_fixtures.demo_session_autouse None

Session-scoped autouse. Shows SESSION + AUTO + FIXTURE badges.

Note

Created once per test session and shared across all tests. Requesting this fixture does not create a new instance per test.

Autouse:

yes — runs automatically for every test

Note

No request needed — this fixture runs automatically for every test.

Plugin page helper

Install

$ pip install sphinx-autodoc-pytest-fixtures

Note

pytest auto-detects this plugin through the pytest11 entry point. Its fixtures are available without extra conftest.py imports.

Add project-specific usage notes here. The helper renders the install section, autodiscovery note, and full fixture summary/reference.

Fixture Reference

fixture spf_demo_fixtures.demo_plain str
fixture[source]
fixture[source]
fixture spf_demo_fixtures.demo_plain str

Plain function-scope resource. Shows FIXTURE badge only.

fixture spf_demo_fixtures.demo_session str
session fixture[source]
session fixture[source]
fixture spf_demo_fixtures.demo_session str

Session-scoped resource. Shows SESSION + FIXTURE badges.

Note

Created once per test session and shared across all tests. Requesting this fixture does not create a new instance per test.

fixture spf_demo_fixtures.demo_module str
module fixture[source]
module fixture[source]
fixture spf_demo_fixtures.demo_module str

Module-scoped resource. Shows MODULE + FIXTURE badges.

fixture spf_demo_fixtures.demo_class str
class fixture[source]
class fixture[source]
fixture spf_demo_fixtures.demo_class str

Class-scoped resource. Shows CLASS + FIXTURE badges.

fixture spf_demo_fixtures.demo_factory type[str]
factory fixture[source]
factory fixture[source]
fixture spf_demo_fixtures.demo_factory type[str]

Return a callable (factory kind). Shows FACTORY + FIXTURE badges.

def test_example(demo_factory: type[str]) -> None:
    obj = demo_factory()
    assert obj is not None
fixture spf_demo_fixtures.demo_override_hook str
fixture[source]
fixture[source]
fixture spf_demo_fixtures.demo_override_hook str

Override hook — customise in conftest.py. Shows OVERRIDE + FIXTURE badges.

fixture spf_demo_fixtures.demo_autouse None
auto fixture[source]
auto fixture[source]
fixture spf_demo_fixtures.demo_autouse None

Autouse fixture. Shows AUTO + FIXTURE badges.

Autouse:

yes — runs automatically for every test

Note

No request needed — this fixture runs automatically for every test.

fixture spf_demo_fixtures.demo_deprecated str
fixture[source]
fixture[source]
fixture spf_demo_fixtures.demo_deprecated str

Return a value (deprecated since 1.0, replaced by demo_plain).

This fixture is documented with the deprecated RST option so the demo page can show the DEPRECATED + FIXTURE badge combination.

fixture spf_demo_fixtures.demo_session_factory type[str]
session factory fixture[source]
session factory fixture[source]
fixture spf_demo_fixtures.demo_session_factory type[str]

Session-scoped factory. Shows SESSION + FACTORY + FIXTURE badges.

Note

Created once per test session and shared across all tests. Requesting this fixture does not create a new instance per test.

def test_example(demo_session_factory: type[str]) -> None:
    obj = demo_session_factory()
    assert obj is not None
fixture spf_demo_fixtures.demo_session_autouse None
session auto fixture[source]
session auto fixture[source]
fixture spf_demo_fixtures.demo_session_autouse None

Session-scoped autouse. Shows SESSION + AUTO + FIXTURE badges.

Note

Created once per test session and shared across all tests. Requesting this fixture does not create a new instance per test.

Autouse:

yes — runs automatically for every test

Note

No request needed — this fixture runs automatically for every test.

When to use auto-pytest-plugin

Use this directive for a standard pytest plugin page where you want consistent house-style: an install section, the pytest11 autodiscovery note, and a generated fixture summary and reference.

autofixtures options

Option

Default

Description

:order:

"source"

"source" preserves module order; "alpha" sorts alphabetically

:exclude:

(empty)

Comma-separated fixture names to skip

:no-index:

(off)

Emit descriptions without registering fixtures in the domain index; use when the same module is documented twice on one page

Single autodoc entries

fixture spf_demo_fixtures.demo_plain str
fixture[source]
fixture[source]
fixture spf_demo_fixtures.demo_plain str

Plain function-scope resource. Shows FIXTURE badge only.

fixture spf_demo_fixtures.demo_session_factory type[str]
session factory fixture[source]
session factory fixture[source]
fixture spf_demo_fixtures.demo_session_factory type[str]

Session-scoped factory. Shows SESSION + FACTORY + FIXTURE badges.

Note

Created once per test session and shared across all tests. Requesting this fixture does not create a new instance per test.

def test_example(demo_session_factory: type[str]) -> None:
    obj = demo_session_factory()
    assert obj is not None

Manual domain directive

fixture spf_demo_fixtures.demo_deprecated
deprecated fixture[source]
deprecated fixture[source]
fixture spf_demo_fixtures.demo_deprecated

Return a deprecated value. Use demo_plain instead.

Warning

Deprecated since version 1.0. Use demo_plain instead.

Copyable config snippet

extensions = [
    "sphinx_autodoc_pytest_fixtures",
]

Source on GitHub · PyPI