-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
gh-125997: improve tests for time.sleep()
#128751
Conversation
@vstinner: I plan to merge this one with the following title:
and following commit message: - Add tests for durations of invalid types.
- Add tests for `int` and `float` durations.
- Add tests for (signed) zeroes and durations close to the clock resolution. Should I also add more with coverage with ns durations and for something of order 1e-16 as well? I also want to know if there's an easy way to test that a sleep has been cancelled through a signal (is there a way to exercise a Ctrl+C?) |
Co-authored-by: Victor Stinner <[email protected]>
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.
LGTM
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…128751) - Add tests for durations of invalid types. - Add tests for `int` and `float` durations, including signed zeroes durations. - Add tests for nonzero very small durations and durations close to the clock resolution. --------- (cherry picked from commit b70a567) Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
…128751) - Add tests for durations of invalid types. - Add tests for `int` and `float` durations, including signed zeroes durations. - Add tests for nonzero very small durations and durations close to the clock resolution. --------- (cherry picked from commit b70a567) Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
GH-128795 is a backport of this pull request to the 3.12 branch. |
GH-128796 is a backport of this pull request to the 3.13 branch. |
I'm backporting the tests since the performance regression happened in 3.11 (if we fix that regression in the future, it'll be easier if the tests are already there) |
… (#128795) gh-125997: Increase test coverage for `time.sleep()` (GH-128751) - Add tests for durations of invalid types. - Add tests for `int` and `float` durations, including signed zeroes durations. - Add tests for nonzero very small durations and durations close to the clock resolution. --------- (cherry picked from commit b70a567) Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
… (#128796) gh-125997: Increase test coverage for `time.sleep()` (GH-128751) - Add tests for durations of invalid types. - Add tests for `int` and `float` durations, including signed zeroes durations. - Add tests for nonzero very small durations and durations close to the clock resolution. --------- (cherry picked from commit b70a567) Co-authored-by: Bénédikt Tran <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
Follow-up to #128274 (review).
time.sleep(0)
is slower on Python 3.11 than on Python 3.10 #125997