Skip to content

Commit 61e4bcd

Browse files
committed
Fix ProgramPriorityTests on FreeBSD with high nice value
ProgramPriorityTests has a check for the case where process priority (nice value) cannot be increased any further because it's already at its maximal value (e.g. when tests are run with maximal niceness). 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.
1 parent 7a0f3c1 commit 61e4bcd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/test/test_os.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3287,7 +3287,8 @@ def test_set_get_priority(self):
32873287
os.setpriority(os.PRIO_PROCESS, os.getpid(), base + 1)
32883288
try:
32893289
new_prio = os.getpriority(os.PRIO_PROCESS, os.getpid())
3290-
if base >= 19 and new_prio <= 19:
3290+
# nice value cap is 19 for linux and 20 for FreeBSD
3291+
if base >= 19 and new_prio <= base:
32913292
raise unittest.SkipTest("unable to reliably test setpriority "
32923293
"at current nice level of %s" % base)
32933294
else:

0 commit comments

Comments
 (0)