cpython (2.7): Issue #6419: Fix a test_kqueue failure on some BSD flavors.
http://hg.python.org/cpython/rev/cfd4cd15809e changeset: 83040:cfd4cd15809e branch: 2.7 parent: 83037:1026b1d47f30 user: Charles-Francois Natali <cf.natali@gmail.com> date: Sun Mar 31 20:35:59 2013 +0200 summary: Issue #6419: Fix a test_kqueue failure on some BSD flavors. files: Lib/test/test_kqueue.py | 35 ++++++++++------------------ 1 files changed, 13 insertions(+), 22 deletions(-) diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py --- a/Lib/test/test_kqueue.py +++ b/Lib/test/test_kqueue.py @@ -96,11 +96,6 @@ pass # FreeBSD doesn't raise an exception here server, addr = serverSocket.accept() - if sys.platform.startswith("darwin"): - flags = select.KQ_EV_ADD | select.KQ_EV_ENABLE - else: - flags = 0 - kq = select.kqueue() kq2 = select.kqueue.fromfd(kq.fileno()) @@ -122,11 +117,10 @@ kq2.control([ev], 0) events = kq.control(None, 4, 1) - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - self.assertEqual(events, [ - (client.fileno(), select.KQ_FILTER_WRITE, flags), - (server.fileno(), select.KQ_FILTER_WRITE, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (client.fileno(), select.KQ_FILTER_WRITE), + (server.fileno(), select.KQ_FILTER_WRITE)])) client.send("Hello!") server.send("world!!!") @@ -140,14 +134,12 @@ else: self.fail('timeout waiting for event notifications') - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - - self.assertEqual(events, [ - (client.fileno(), select.KQ_FILTER_WRITE, flags), - (client.fileno(), select.KQ_FILTER_READ, flags), - (server.fileno(), select.KQ_FILTER_WRITE, flags), - (server.fileno(), select.KQ_FILTER_READ, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (client.fileno(), select.KQ_FILTER_WRITE), + (client.fileno(), select.KQ_FILTER_READ), + (server.fileno(), select.KQ_FILTER_WRITE), + (server.fileno(), select.KQ_FILTER_READ)])) # Remove completely client, and server read part ev = select.kevent(client.fileno(), @@ -164,10 +156,9 @@ kq.control([ev], 0, 0) events = kq.control([], 4, 0.99) - events = [(e.ident, e.filter, e.flags) for e in events] - events.sort() - self.assertEqual(events, [ - (server.fileno(), select.KQ_FILTER_WRITE, flags)]) + events = set((e.ident, e.filter) for e in events) + self.assertEqual(events, set([ + (server.fileno(), select.KQ_FILTER_WRITE)])) client.close() server.close() -- Repository URL: http://hg.python.org/cpython
participants (1)
-
charles-francois.natali