Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent collection issues with skip statements inside packages #764

Merged

Conversation

seifertm
Copy link
Contributor

pytest-asyncio-0.23.4a2 suffers from a problem that causes tests to be skipped during the collection phase as described in
#729 (comment)

It turns out the tests were skipped, because the test suite in question used test packages and the first module inside the package issued a pytest.skip statement. The custom collection function for packages introduced in pytest-asyncio-0.23.4a2 tries to access Module.obj which triggers the pytest.skip and causes the collection of the package to abort.

Rather than trying to access Module.obj, this patch adds a package-scoped fixture to a stack each time a package is collected. The first module inside each package tries to pop an item from the stack and adds the popped loop fixture to itself.

…age when any module inside the package used a pytest.skip statement.

Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
@seifertm seifertm added this to the v0.23 milestone Jan 28, 2024
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
@seifertm seifertm added this pull request to the merge queue Jan 28, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (463ce98) 94.37% compared to head (e8e4dbf) 94.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #764      +/-   ##
==========================================
- Coverage   94.37%   94.33%   -0.04%     
==========================================
  Files           2        2              
  Lines         480      477       -3     
  Branches       97       95       -2     
==========================================
- Hits          453      450       -3     
+ Misses         19       17       -2     
- Partials        8       10       +2     

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

Merged via the queue into pytest-dev:main with commit b879130 Jan 28, 2024
14 checks passed
@seifertm seifertm deleted the pydata-sphinx-theme-test-collection branch January 28, 2024 19:07
@seifertm seifertm restored the pydata-sphinx-theme-test-collection branch February 9, 2024 16:16
@seifertm seifertm deleted the pydata-sphinx-theme-test-collection branch February 9, 2024 16:32
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.

None yet

2 participants