pytest-dev/pytest

Expose FixtureFunctionDefinition as part of the public API

Ouverte

#14 853 ouverte le 11 août 2026

 (1 commentaire) (0 réaction) (1 personne assignée)Python (2 476 forks)batch import
good first issuetopic: fixtures

Métriques du dépôt

Stars
 (11 012 étoiles)
Métriques de merge PR
 (Merge moyen 4j 1h) (59 PRs mergées en 30 j)

Description

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

Guide contributeur