From ce1519d250ca457e60a91943d7686e2b85764170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Fran=C3=A7ois=20Natali?= Date: Sun, 13 Jan 2013 13:56:52 +0100 Subject: test_asyncore: wait explicitly for a thread termination (this dangling thread could be the cause of a random failure). --- Lib/test/test_asyncore.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 5f55df8..8989a63 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -738,6 +738,7 @@ class BaseTestAPI(unittest.TestCase): server = TCPServer() t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1, count=500)) t.start() + self.addCleanup(t.join) for x in range(20): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -- cgit v0.12 From c78de46912c29a9cca58b90535a31a2656ca6ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Fran=C3=A7ois=20Natali?= Date: Sun, 13 Jan 2013 14:10:37 +0100 Subject: 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. --- Lib/test/test_posix.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 26d5570..5843b03 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) -- cgit v0.12