summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2013-01-13 13:13:25 (GMT)
committerCharles-François Natali <cf.natali@gmail.com>2013-01-13 13:13:25 (GMT)
commitb402a5c01b2010fc2409e5cb137cde86c4b6cbf3 (patch)
tree25e5283d0f00b785fcef032acb328ec1f144743d /Lib
parentadbfcb83a23d9154ef68a45e70d7fc00655f0224 (diff)
downloadcpython-b402a5c01b2010fc2409e5cb137cde86c4b6cbf3.zip
cpython-b402a5c01b2010fc2409e5cb137cde86c4b6cbf3.tar.gz
cpython-b402a5c01b2010fc2409e5cb137cde86c4b6cbf3.tar.bz2
Fix test_posix failure on NetBSD buildbots: sched_setparam() and
sched_setscheduler() can fail with EINVAL if the process scheduling policy is neither SCHED_FIFO nor SCHED_RR.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_posix.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index ebad4ea..1352943 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -930,17 +930,17 @@ class PosixTester(unittest.TestCase):
self.assertRaises(OSError, posix.sched_getparam, -1)
param = posix.sched_getparam(0)
self.assertIsInstance(param.sched_priority, int)
- try:
- posix.sched_setscheduler(0, mine, param)
- except OSError as e:
- if e.errno != errno.EPERM:
- raise
- # 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)
+ # POSIX states that calling sched_setparam() or sched_setscheduler() on
+ # a process with a scheduling policy other than SCHED_FIFO or SCHED_RR
+ # is implementation-defined: NetBSD and FreeBSD can return EINVAL.
+ if not sys.platform.startswith(('freebsd', 'netbsd')):
+ try:
+ posix.sched_setscheduler(0, mine, param)
+ posix.sched_setparam(0, param)
+ except OSError as e:
+ if e.errno != errno.EPERM:
+ raise
self.assertRaises(OSError, posix.sched_setparam, -1, param)
self.assertRaises(OSError, posix.sched_setscheduler, -1, mine, param)