[Python-checkins] cpython (3.3): Fix test_posix failure on NetBSD buildbots: sched_setparam() and

charles-francois.natali python-checkins at python.org
Sun Jan 13 14:15:58 CET 2013


http://hg.python.org/cpython/rev/1719136ca357
changeset:   81476:1719136ca357
branch:      3.3
user:        Charles-François Natali <cf.natali at gmail.com>
date:        Sun Jan 13 14:10:37 2013 +0100
summary:
  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.

files:
  Lib/test/test_posix.py |  20 ++++++++++----------
  1 files changed, 10 insertions(+), 10 deletions(-)


diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -930,17 +930,17 @@
         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)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list