Skip to content

gh-125997: improve tests for time.sleep() - #128751

Merged
picnixz merged 2 commits into
python:mainfrom
picnixz:test/time/sleep-125997
Jan 13, 2025
Merged

gh-125997: improve tests for time.sleep()#128751
picnixz merged 2 commits into
python:mainfrom
picnixz:test/time/sleep-125997

Conversation

@picnixz

@picnixzpicnixz commented Jan 12, 2025

Copy link
Copy Markdown
Member

@picnixz

picnixz commented Jan 13, 2025

Copy link
Copy Markdown
MemberAuthor

@vstinner: I plan to merge this one with the following title:

Increase test coverage for `time.sleep()`.

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?)

Comment threadLib/test/test_time.py Outdated
Co-authored-by: Victor Stinner <vstinner@python.org>

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@picnixz
picnixz merged commit b70a567 into python:mainJan 13, 2025
@picnixz
picnixz deleted the test/time/sleep-125997 branch January 13, 2025 16:58
@picnixzpicnixz added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes labels Jan 13, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @picnixz for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 13, 2025
…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 <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 13, 2025
…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 <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-app

Copy link
Copy Markdown

GH-128795 is a backport of this pull request to the 3.12 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.12 only security fixes label Jan 13, 2025
@bedevere-app

Copy link
Copy Markdown

GH-128796 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Jan 13, 2025
@picnixz

Copy link
Copy Markdown
MemberAuthor

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)

picnixz added a commit that referenced this pull request Jan 13, 2025
… (#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 <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
picnixz added a commit that referenced this pull request Jan 13, 2025
… (#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 <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
@bedevere-bot

This comment was marked as resolved.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@picnixz@bedevere-bot@vstinner