From: Charles-François Natali Date: Sun, 21 Aug 2011 10:41:43 +0000 (+0200) Subject: Issue #12783: Fix test_posix failures on FreeBSD buildbots, due to X-Git-Tag: v3.3.0a1~1655 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7b911cb62193a82b084926aec3b0bcaaaf1af865;p=thirdparty%2FPython%2Fcpython.git Issue #12783: Fix test_posix failures on FreeBSD buildbots, due to sched_setparam() returning EINVAL for processes with SCHED_OTHER scheduling policy. --- diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 6a3c33f3a1bd..a098fc088b1a 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -875,8 +875,14 @@ class PosixTester(unittest.TestCase): except OSError as e: if e.errno != errno.EPERM: raise - posix.sched_setparam(0, param) - self.assertRaises(OSError, posix.sched_setparam, -1, param) + + # POSIX states that calling sched_setparam() on a process with a + # scheduling policy other than SCHED_FIFO or SCHED_RR is + # implementation-defined: FreeBSD returns EINVAL. + if not sys.platform.startswith('freebsd'): + posix.sched_setparam(0, param) + self.assertRaises(OSError, posix.sched_setparam, -1, param) + self.assertRaises(OSError, posix.sched_setscheduler, -1, mine, param) self.assertRaises(TypeError, posix.sched_setscheduler, 0, mine, None) self.assertRaises(TypeError, posix.sched_setparam, 0, 43)