pytest-dev/pytest

Expose FixtureFunctionDefinition as part of the public API

Aperta

#14.853 aperta il 11 ago 2026

 (1 commento) (0 reazioni) (1 assegnatario)Python (2476 fork)batch import
good first issuetopic: fixtures

Metriche repository

Star
 (11.012 stelle)
Metriche merge PR
 (Merge medio 4g 1h) (59 PR mergiate in 30 g)

Descrizione

There doesn’t appear to be a public type that can be used to annotate the result of pytest.fixture.

For example, consider a factory which creates fixtures:

from _pytest.fixtures import FixtureFunctionDefinition

def make_fixture(value: str) -> FixtureFunctionDefinition:
    @pytest.fixture
    def fixture() -> str:
        return value
    return fixture

Guida contributor