-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add distinction between error cases in TimerContext #10159
base: master
Are you sure you want to change the base?
Conversation
Let me know if you would like a test that checks the specific error messages for the different cases. Is there any relevant documentation to update for this change? I don't think it is worth adding an entry to CHANGES/ but I can do. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #10159 +/- ##
==========================================
- Coverage 98.75% 98.74% -0.01%
==========================================
Files 122 122
Lines 36954 36956 +2
Branches 4411 4412 +1
==========================================
- Hits 36494 36493 -1
- Misses 313 316 +3
Partials 147 147
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #10159 will degrade performances by 10.92%Comparing Summary
Benchmarks breakdown
|
eff0c64
to
6faaa4d
Compare
Yeah, we'll want a test case for coverage.
Agreed, leave it. |
I'm a little confused what happened to the coverage, it says master has coverage of the existing exception, but this change doesn't have coverage of either of the exceptions... |
...unless asyncio.current_task() is managing to cause a RuntimeError itself and the tests aren't checking the exception text.. |
6faaa4d
to
62e0259
Compare
Yep you're right. I have updated it to a try-except. Now the behaviour is correct. The original error case is still hit if used outside of an event loop entirely, as shown in the test. I get the new error in my application when used in the wrong event loop. However, I am having trouble provoking the latter error case in a test, because the main event loop happens to have another task, so Do you have any suggestions on how this could be done? Do you think this is now adding too much complication for the sake of an error message? |
62e0259
to
5ad9083
Compare
Odd, the docs don't seem to suggest such behaviour.
I'm not too sure how to make it work. Maybe it's not worth the effort, but I've never used multiple loops before. Up to you if you want to continue pursuing it. |
What do these changes do?
This adds a distinct error message in the case that
TimerContext
is used within a task, but the task is on a different event loop.Are there changes in behavior for the user?
The user will get a slightly different - and hopefully more useful - error message in the above case.
Is it a substantial burden for the maintainers to support this?
No.
Related issue number
Fixes #10153
Checklist
CONTRIBUTORS.txt
CHANGES/
foldername it
<issue_or_pr_num>.<type>.rst
(e.g.588.bugfix.rst
)if you don't have an issue number, change it to the pull request
number after creating the PR
.bugfix
: A bug fix for something the maintainers deemed animproper undesired behavior that got corrected to match
pre-agreed expectations.
.feature
: A new behavior, public APIs. That sort of stuff..deprecation
: A declaration of future API removals and breakingchanges in behavior.
.breaking
: When something public is removed in a breaking way.Could be deprecated in an earlier release.
.doc
: Notable updates to the documentation structure or buildprocess.
.packaging
: Notes for downstreams about unobvious side effectsand tooling. Changes in the test invocation considerations and
runtime assumptions.
.contrib
: Stuff that affects the contributor experience. e.g.Running tests, building the docs, setting up the development
environment.
.misc
: Changes that are hard to assign to any of the abovecategories.
Make sure to use full sentences with correct case and punctuation,
for example:
Use the past tense or the present tense a non-imperative mood,
referring to what's changed compared to the last released version
of this project.