]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] Fix ProgramPriorityTests on FreeBSD with high nice value (GH-100145) (GH-115614)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 17 Feb 2024 15:35:34 +0000 (16:35 +0100)
committerGitHub <noreply@github.com>
Sat, 17 Feb 2024 15:35:34 +0000 (15:35 +0000)
It expects priority to be capped with 19, which is the cap for Linux,
but for FreeBSD the cap is 20 and the test fails under the similar
conditions. Tweak the condition to cover FreeBSD as well.
(cherry picked from commit 437924465de5cb81988d1e580797b07090c26a28)

Co-authored-by: Dmitry Marakasov <amdmi3@amdmi3.ru>
Lib/test/test_os.py

index fc58f8d2dcd7a343acbcc2acb21d5ed33269e8ba..94e77007e474ea8a4eb717d30b646a85dfc92d9a 100644 (file)
@@ -3490,7 +3490,8 @@ class ProgramPriorityTests(unittest.TestCase):
         os.setpriority(os.PRIO_PROCESS, os.getpid(), base + 1)
         try:
             new_prio = os.getpriority(os.PRIO_PROCESS, os.getpid())
-            if base >= 19 and new_prio <= 19:
+            # nice value cap is 19 for linux and 20 for FreeBSD
+            if base >= 19 and new_prio <= base:
                 raise unittest.SkipTest("unable to reliably test setpriority "
                                         "at current nice level of %s" % base)
             else: