Skip to content

Conversation

@seifertm
Copy link
Contributor

@seifertm seifertm commented Sep 3, 2025

This PR adds additional information for the type checker to is_async_test(Item). This allows the type checker to narrow the type and avoids subsequent assert statements or the use of typing.cast.

In order to use typing.TypeIs, the dependency on typing-extensions is extended to more recent Python versions.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.86%. Comparing base (7ca56e3) to head (439dfaf).

Files with missing lines Patch % Lines
pytest_asyncio/plugin.py 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1213      +/-   ##
==========================================
+ Coverage   90.81%   90.86%   +0.04%     
==========================================
  Files           2        2              
  Lines         403      405       +2     
  Branches       43       44       +1     
==========================================
+ Hits          366      368       +2     
  Misses         29       29              
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 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 pull request to the merge queue Sep 3, 2025
Merged via the queue into pytest-dev:main with commit c68337e Sep 3, 2025
22 checks passed
@seifertm seifertm deleted the feat/is_async_test_type_narrowing branch September 3, 2025 08:50
@seifertm seifertm added this to the v1.2 milestone Sep 3, 2025
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.

2 participants