-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
DeprecationWarning if sync test requests async fixture #12930
Merged
Merged
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
6728ec5
Raise error if sync test relies on async fixture, and warn if the fix…
jakkdl 5c41d50
Merge remote-tracking branch 'origin/main' into sync_test_async_fixture
jakkdl 8e100ea
fix tests
jakkdl 283db4e
add changelog
jakkdl 5beab07
improve warning message. Make it warn regardless of autouse or not. A…
jakkdl 2d06ff2
Merge branch 'main' into sync_test_async_fixture
jakkdl 0de5302
fix test
jakkdl 1891fed
Rename changelog entries to 'breaking' (#12942)
nicoddemus 6b9de2a
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] 94dd153
Upgrade pylint version, activate all extensions
Pierre-Sassoulas b19fd52
[pylint dict-init-mutate] Initialize a dict right off for speed
Pierre-Sassoulas 987904c
[automated] Update plugin list (#12950)
github-actions[bot] 70639ef
build(deps): Bump django in /testing/plugins_integration (#12951)
dependabot[bot] 7256c0c
build(deps): Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.12.2 (…
dependabot[bot] c98ef2b
change implementation so the check happens in pytest_fixture_setup af…
jakkdl cd3eb98
fix test
jakkdl 2d9bb86
Merge branch 'main' into sync_test_async_fixture
jakkdl 876cc2a
update docs/changelog
jakkdl 1a4dfbb
remove incorrect comments, add link
jakkdl d35e4eb
revert now unrelated fix
jakkdl ef096cd
small wording changes
jakkdl 49c140d
Apply suggestions from code review
jakkdl f434c27
be more explicit about the downside of async autouse fixtures
jakkdl 7084940
fix tests after message change
jakkdl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Requesting an asynchronous fixture without a `pytest_fixture_setup` hook that resolves it will now give a DeprecationWarning. This most commonly happens if a sync test requests an async fixture. This should have no effect on a majority of users with async tests or fixtures using async pytest plugins, but may affect non-standard hook setups or ``autouse=True``. For guidance on how to work around this warning see :ref:`sync-test-async-fixture`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should be more explicit why we recommend against this practice in core pytest? I mean this is something a plugin could support correctly in theory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some fundamental issues with how to handle it correctly, currently anyio will suspend the async runloop during execution of the sync test. And we also can't simply wrap the test as an async task, as that will lack checkpoints and will hug the runloop. You probably could run it in a separate thread, but yeah anyio doesn't support that currently.