pytest-dev/pytest

Expose FixtureFunctionDefinition as part of the public API

开放

#14,853 创建于 2026年8月11日

 (1 条评论) (0 个反应) (1 位负责人)Python (2,476 个派生)batch import
good first issuetopic: fixtures

仓库指标

星标
 (11,012 个星标)
PR 合并指标
 (平均合并 4天 1小时) (30 天内合并 59 个 PR)

描述

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

贡献者指南