]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix ProgramPriorityTests on FreeBSD with high nice value (GH-100145)
authorDmitry Marakasov <amdmi3@amdmi3.ru>
Sat, 17 Feb 2024 14:54:47 +0000 (17:54 +0300)
committerGitHub <noreply@github.com>
Sat, 17 Feb 2024 14:54:47 +0000 (14:54 +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.

Lib/test/test_os.py

index 2c8823ae47c726ec6d5678c9fbd932ade94d5985..ce778498c61d875d84ee4ca80ab802987a289e3e 100644 (file)
@@ -3511,7 +3511,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: