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

Configuration option for default loop scope #793

Open
seifertm opened this issue Feb 28, 2024 · 1 comment
Open

Configuration option for default loop scope #793

seifertm opened this issue Feb 28, 2024 · 1 comment
Milestone

Comments

@seifertm
Copy link
Contributor

seifertm commented Feb 28, 2024

When a user wants to run all tests in a session-scoped event loop, the documentation suggests implementing a pytest_collection_modifyitems hook.

In auto mode the hook causes duplicate asyncio markers to be attached to test items. This is a cosmetic issue, but creates additional noise when debugging item markers.

In strict mode the behavior of the hook rules out manual overrides of the asyncio mark.

A configuration option for the default loop scope as suggested in #705 (comment) would eliminate duplicate asyncio markers in auto mode and allow overriding the default loop scope with explicit markers in strict mode.

@seifertm seifertm added this to the v1.0 milestone Feb 28, 2024
@minrk
Copy link

minrk commented Aug 7, 2024

0.24 adds essentially this option for fixtures in asyncio_default_fixture_loop_scope. It seems logical to me to add an equivalent for tests as well at the same time. The modifyitems approach definitely works, but is more complex, and having this option only for fixtures makes it all the more tantalizing to not have it for the tests themselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants