Skip to content

Allow AsyncIterable as a return type for async generator fixutures#1481

Open
seifertm wants to merge 5 commits into
pytest-dev:mainfrom
seifertm:fix-async-gen-fixture-typing
Open

Allow AsyncIterable as a return type for async generator fixutures#1481
seifertm wants to merge 5 commits into
pytest-dev:mainfrom
seifertm:fix-async-gen-fixture-typing

Conversation

@seifertm

@seifertm seifertm commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

This PR adds AsyncIterable to the supported return values of async generator fixtures decorated with pytest_asyncio.fixture.

The patch also simplifies the type signature of pytest_asyncio.fixture by removing superfluous Any specifiers for generic types, extends type checking to test code, and wraps remaining Hypothesis tests into pytest.Pytester to avoid requiring hypothesis as a type checking dependency.

Closes #1090

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.50%. Comparing base (bf5b4e0) to head (b3cd305).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1481   +/-   ##
=======================================
  Coverage   94.50%   94.50%           
=======================================
  Files           2        2           
  Lines         510      510           
  Branches       62       62           
=======================================
  Hits          482      482           
  Misses         22       22           
  Partials        6        6           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@seifertm seifertm added this to the v1.4 milestone Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type error: Value of type variable "_R" of function cannot be "AsyncClient"

2 participants