Honor return annotations of async pytest fixtures

Async fixtures skipped the annotation branch, so a `-> T` annotation was
ignored and only the body was inferred. Infer the annotation directly:
the awaited value for coroutines, and the yielded value for annotated
async generators. Add cases where the body is not inferable.

Also drop the tooling note from the AUTHORS entry.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Abdullah AhmedandClaude Sonnet 5.5 committed 2026-10-12 04:52:32 -04:00
1 parent d8efff8e30
commit 3f7e8adddc
3 files changed
+35 -5

No files matched your search

+18 -1
View File
@@ -1,4 +1,4 @@
from typing import Generator
from typing import AsyncGenerator, Generator
import pytest
from pytest import fixture
@@ -229,6 +229,16 @@ async def async_yield_fixture():
yield 1.0
@pytest.fixture
async def async_annotated_opaque() -> int:
return opaque_value
@pytest.fixture
async def async_generator_annotated() -> AsyncGenerator[str, None]:
yield opaque_value
#? ['async_fixture']
def test_async_fixture_completion(async_fixt
pass
@@ -243,6 +253,13 @@ def test_async_fixture_inference(async_fixture, async_annotated_fixture, async_y
async_yield_fixture
def test_async_fixture_annotation(async_annotated_opaque, async_generator_annotated):
#? int()
async_annotated_opaque
#? str()
async_generator_annotated
#! 30 ['def async_fixture']
def test_async_fixture_goto(async_fixture):
pass