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

fix compatibility with pytest ^8 #776

Merged
merged 4 commits into from
Feb 6, 2024
Merged

Conversation

akeeman
Copy link
Contributor

@akeeman akeeman commented Feb 6, 2024

fixes #737

pytest-asyncio is incompatible with pytest 8.0.0rc1 and 8.0.0rc2, but not with pytest 8.0.0. Although 2 tests had to be updated, as suggested here by @mgorny.

  • test_asyncio_mark_provides_session_scoped_loop_strict_mode: order of module collection has changed from files first to mixed files and folders (source)
  • test_returns_false_for_unmarked_coroutine_item_in_strict_mode: raises a failure now (again)

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e92efad) 94.33% compared to head (d53c129) 94.96%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #776      +/-   ##
==========================================
+ Coverage   94.33%   94.96%   +0.62%     
==========================================
  Files           2        2              
  Lines         477      477              
  Branches       95       95              
==========================================
+ Hits          450      453       +3     
+ Misses         17       15       -2     
+ Partials       10        9       -1     

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

@mgorny
Copy link
Contributor

mgorny commented Feb 6, 2024

Thanks for doing this!

… and pytest-8.0.0rc2 from the excluded versions.

Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
@seifertm seifertm self-assigned this Feb 6, 2024
Copy link
Contributor

@seifertm seifertm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

I think some of the version changes are problematic. Other than that, the PR looks good.

If you don't mind, I'll adjust the version numbers myself and add a changelog entry. Maybe this allows us to get out a pre-release for pytest-asyncio with pytest 8 support today.

@@ -1,3 +1,3 @@
# Always adjust install_requires in setup.cfg and pytest-min-requirements.txt
# when changing runtime dependencies
pytest >= 7.0.0,<8
pytest >= 7.0.0, !=8.0.0rc1, !=8.0.0rc2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran your patch successfully against pytest-8.0.0rc1 and pytest-8.0.0rc2. This means there's not reason to exclude them in the compatible versions. It's more likely that #764 reduced the number of issues with the collection changes in pytest.

More importantly, we should try to keep the upper version bound at all costs, both in requirements.txt and especially in setup.py. Otherwise we assume that pytest-asyncio is compatible with potentially breaking changes in pytest 9.

@@ -14,7 +14,7 @@ packaging==23.2
pluggy==1.3.0
py==1.11.0
Pygments==2.16.1
pytest==7.0.0
pytest==8.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intention of the pytest-min environment is to test against an older version of pytest. This way, pytest-asyncio doesn't accidentally use any of the newer pytest features without a proper bump of the minimum supported version.

I think we should continue to support pytest 7 for at least a short period of time, in order to allow users to migrate pytest independently from pytest-asyncio.

This should allow users to update pytest independently from pytest-asyncio.

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 Feb 6, 2024
@seifertm seifertm merged commit 42b140d into pytest-dev:main Feb 6, 2024
14 checks passed
@akeeman akeeman deleted the patch-1 branch February 6, 2024 18:54
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.

Support for Pytest 8.0
4 participants