summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles-Francois Natali <cf.natali@gmail.com>2013-03-31 18:36:57 (GMT)
committerCharles-Francois Natali <cf.natali@gmail.com>2013-03-31 18:36:57 (GMT)
commit7a03e2d37735df858fde31079e21f64b88e00224 (patch)
tree2105eea74da9a1bf40fa56f8836bf27a2d7e1e8e
parente5aefa452b2e3a5a834610cefa1656f36673f686 (diff)
downloadcpython-7a03e2d37735df858fde31079e21f64b88e00224.zip
cpython-7a03e2d37735df858fde31079e21f64b88e00224.tar.gz
cpython-7a03e2d37735df858fde31079e21f64b88e00224.tar.bz2
Issue #6419: Fix a test_kqueue failure on some BSD flavors.
-rw-r--r--Lib/test/test_kqueue.py35
1 files changed, 13 insertions, 22 deletions
diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py
index 4e93013..149e6b6 100644
--- a/Lib/test/test_kqueue.py
+++ b/Lib/test/test_kqueue.py
@@ -101,11 +101,6 @@ class TestKQueue(unittest.TestCase):
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())
@@ -127,11 +122,10 @@ class TestKQueue(unittest.TestCase):
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(b"Hello!")
server.send(b"world!!!")
@@ -145,14 +139,12 @@ class TestKQueue(unittest.TestCase):
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(),
@@ -169,10 +161,9 @@ class TestKQueue(unittest.TestCase):
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()