From 9dfbe1e2747a0585d370d594dd918684e503952b Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Mon, 24 Feb 2025 12:48:32 +0000 Subject: [PATCH] gh-130363: add a test resource to mark tests that need an idle system Some tests are very sensitive to timing and will fail on a loaded system, typically because there are small windows for timeouts to trigger in. Some of these are poorly implemented tests which can be improved, but others may genuinely have strict timing requirements. Add a test resource so that these tests can be marked as such, and only ran when the system is known to be idle. --- Lib/test/libregrtest/cmdline.py | 3 +++ Lib/test/libregrtest/utils.py | 2 +- .../next/Tests/2025-02-24-12-50-56.gh-issue-130363.zeM6ig.rst | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Tests/2025-02-24-12-50-56.gh-issue-130363.zeM6ig.rst diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py index 81c7106ac0c0f4..45d7015cc78b52 100644 --- a/Lib/test/libregrtest/cmdline.py +++ b/Lib/test/libregrtest/cmdline.py @@ -122,6 +122,9 @@ tzdata - Run tests that require timezone data. + idle - Run tests that require an otherwise idle system as + they are sensitive to timing. + To enable all resources except one, use '-uall,-'. For example, to run all the tests except for the gui tests, give the option '-uall,-gui'. diff --git a/Lib/test/libregrtest/utils.py b/Lib/test/libregrtest/utils.py index 3eff9e753b6d84..1b0226108d17f5 100644 --- a/Lib/test/libregrtest/utils.py +++ b/Lib/test/libregrtest/utils.py @@ -33,7 +33,7 @@ ALL_RESOURCES = ('audio', 'curses', 'largefile', 'network', - 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'walltime') + 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'walltime', 'idle') # Other resources excluded from --use=all: # diff --git a/Misc/NEWS.d/next/Tests/2025-02-24-12-50-56.gh-issue-130363.zeM6ig.rst b/Misc/NEWS.d/next/Tests/2025-02-24-12-50-56.gh-issue-130363.zeM6ig.rst new file mode 100644 index 00000000000000..34307b908c681f --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2025-02-24-12-50-56.gh-issue-130363.zeM6ig.rst @@ -0,0 +1,2 @@ +Add the ``idle`` resource for flagging tests that need an idle system as +they're sensitive to timing.