From ae8ec0111b3f884248f88bc30227095aefdb7002 Mon Sep 17 00:00:00 2001 From: jxes993409 <68891412+jxes993409@users.noreply.github.com> Date: Fri, 12 Sep 2025 17:37:53 +0800 Subject: [PATCH 1/2] gh-138163: skip failures if tests are run with `SCHED_BATCH` on glibc (GH-138576) (cherry picked from commit 492941459acb5b5a104d96414288601d2e2b7e6f) Co-authored-by: jxes993409 <68891412+jxes993409@users.noreply.github.com> --- Lib/test/test_posix.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index bfc1e2b251f6db..7c8a59a773a7a7 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1991,6 +1991,12 @@ def test_setscheduler_only_param(self): @requires_sched @unittest.skipIf(sys.platform.startswith(('freebsd', 'netbsd')), "bpo-34685: test can fail on BSD") + @unittest.skipIf(platform.libc_ver()[0] == 'glibc' and + os.sched_getscheduler(0) in [ + os.SCHED_BATCH, + os.SCHED_IDLE, + os.SCHED_DEADLINE], + "Skip test due to glibc posix_spawn policy") def test_setscheduler_with_policy(self): policy = os.sched_getscheduler(0) priority = os.sched_get_priority_min(policy) From 336039ca45e59334baf65f0ae5763131bccdb124 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Mon, 15 Sep 2025 14:31:42 +0200 Subject: [PATCH 2/2] Remove SCHED_DEADLINE --- Lib/test/test_posix.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 7c8a59a773a7a7..c327d2add2f1cd 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1994,8 +1994,7 @@ def test_setscheduler_only_param(self): @unittest.skipIf(platform.libc_ver()[0] == 'glibc' and os.sched_getscheduler(0) in [ os.SCHED_BATCH, - os.SCHED_IDLE, - os.SCHED_DEADLINE], + os.SCHED_IDLE], "Skip test due to glibc posix_spawn policy") def test_setscheduler_with_policy(self): policy = os.sched_getscheduler(0)