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

feat: Configuration option for setting default loop_scope for tests #1035

Merged

Conversation

Novakov
Copy link
Contributor

@Novakov Novakov commented Jan 6, 2025

New configuration option, asyncio_default_test_loop_scope, provides default value for loop_scope argument of asyncio marker. This can be used to use the same event loop in auto mode without need to use modifyitems hook.

Test functions can still override loop_scope by using asyncio marker.

Implements #793

@Novakov Novakov force-pushed the config-option-default-test-loop-scope branch 4 times, most recently from cb06135 to 5272cc4 Compare January 6, 2025 11:53
@codecov-commenter
Copy link

codecov-commenter commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.27%. Comparing base (2188cdb) to head (6c3a941).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1035      +/-   ##
==========================================
+ Coverage   91.13%   91.27%   +0.13%     
==========================================
  Files           2        2              
  Lines         564      573       +9     
  Branches       74       75       +1     
==========================================
+ Hits          514      523       +9     
  Misses         30       30              
  Partials       20       20              

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

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.

Thank you! I really like how you changed _get_marked_loop_scope and how you used functions to keep the code readable.

Can you please add an entry to docs/reference/changelog.rst where you link to #793 ?
Assume that this PR bumps the minor version and set the date to UNRELEASED.

docs/how-to-guides/index.rst Show resolved Hide resolved
@seifertm seifertm linked an issue Jan 8, 2025 that may be closed by this pull request
@Novakov Novakov force-pushed the config-option-default-test-loop-scope branch 2 times, most recently from 787a67d to aa2339d Compare January 8, 2025 16:17
New configuration option, asyncio_default_test_loop_scope, provides
default value for loop_scope argument of asyncio marker. This can be
used to use the same event loop in auto mode without need to use
modifyitems hook.

Test functions can still override loop_scope by using asyncio marker.
@Novakov Novakov force-pushed the config-option-default-test-loop-scope branch from aa2339d to 6c3a941 Compare January 8, 2025 16:20
@Novakov
Copy link
Contributor Author

Novakov commented Jan 8, 2025

Thanks for kind words. I've rebased this branch and applied modifications you requested.

@seifertm seifertm self-requested a review January 15, 2025 05:51
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!

@seifertm seifertm added this pull request to the merge queue Jan 15, 2025
@seifertm seifertm added this to the v0.26 milestone Jan 15, 2025
Merged via the queue into pytest-dev:main with commit 5a0c567 Jan 15, 2025
15 checks passed
@Novakov Novakov deleted the config-option-default-test-loop-scope branch January 15, 2025 07:20
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.

Configuration option for default loop scope
3 participants