Skip to content

Conversation

@seifertm
Copy link
Contributor

@seifertm seifertm commented Sep 3, 2025

This patch moves logic for test setup from a pytest hook to the respective pytest-asyncio test item classes.

Compared to performing the same logic in a pytest hook, this approach centralizes the logic for test execution and makes it easier to follow the program flow. The fact that the setup code executes inside the concrete subclass of PytestAsyncioFunction rather than a generic pytest.Item leads to fewer safety checks as an added benefit.

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.81%. Comparing base (c68337e) to head (c9f2eb9).

Files with missing lines Patch % Lines
pytest_asyncio/plugin.py 88.88% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1214      +/-   ##
==========================================
- Coverage   90.86%   90.81%   -0.05%     
==========================================
  Files           2        2              
  Lines         405      403       -2     
  Branches       44       43       -1     
==========================================
- Hits          368      366       -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 b398244 Sep 3, 2025
21 of 22 checks passed
@seifertm seifertm deleted the move-test-setup-logic-to-test-classes branch September 3, 2025 09:10
@seifertm seifertm restored the move-test-setup-logic-to-test-classes branch September 3, 2025 09:16
@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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants