From f25900eb20cf39884e164a652c55c359afdd34f1 Mon Sep 17 00:00:00 2001 From: jxes993409 Date: Fri, 5 Sep 2025 16:27:10 +0800 Subject: [PATCH 1/2] gh-138163: scheduler tests for posix_spawn fail on glibc for `SCHED_BATCH` --- Lib/test/test_posix.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 628920e34b586f..5f164e017e61f8 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -2036,6 +2036,9 @@ 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], + "On glibc, posix_spawnattr_setschedpolicy cannot change the policy") def test_setscheduler_with_policy(self): policy = os.sched_getscheduler(0) priority = os.sched_get_priority_min(policy) From df655449d2a43c6a794646d0bc960e1637e17f90 Mon Sep 17 00:00:00 2001 From: jxes993409 Date: Fri, 12 Sep 2025 15:37:31 +0800 Subject: [PATCH 2/2] Wrap long line to comply with PEP 8 --- Lib/test/test_posix.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 5f164e017e61f8..fd48ccc686ddd4 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -2037,8 +2037,11 @@ def test_setscheduler_only_param(self): @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], - "On glibc, posix_spawnattr_setschedpolicy cannot change the policy") + 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)