[3.12] Fix ProgramPriorityTests on FreeBSD with high nice value (GH-100145) (GH-115614)

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 437924465d)

Co-authored-by: Dmitry Marakasov <amdmi3@amdmi3.ru>
This commit is contained in:
Miss Islington (bot) 2024-02-17 16:35:34 +01:00 committed by GitHub
parent e32cde54f5
commit 9563e46a78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View 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: