summaryrefslogtreecommitdiff
path: root/tests/hub_test.py
diff options
context:
space:
mode:
authorRyan Williams <breath@alum.mit.edu>2011-04-02 17:16:07 -0700
committerRyan Williams <breath@alum.mit.edu>2011-04-02 17:16:07 -0700
commit2dd4148f2cfe04bde8fb23be4f47df6c8d3380bb (patch)
tree43717b0becc729e5b25cda2cef53da48ad7e9812 /tests/hub_test.py
parent18adbba35ef1e75cac41793b04db3afa409de353 (diff)
downloadeventlet-2dd4148f2cfe04bde8fb23be4f47df6c8d3380bb.tar.gz
Ignoring EEXIST in epoll hub on register. Should fix #80.
Diffstat (limited to 'tests/hub_test.py')
-rw-r--r--tests/hub_test.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/hub_test.py b/tests/hub_test.py
index 3931430..59d6da0 100644
--- a/tests/hub_test.py
+++ b/tests/hub_test.py
@@ -213,6 +213,42 @@ class TestBadFilenos(LimitedTestCase):
from eventlet.green import select
self.assertRaises(ValueError, select.select, [-1], [], [])
self.assertRaises(ValueError, select.select, [-1], [], [])
+
+
+from tests.patcher_test import ProcessBase
+class TestFork(ProcessBase):
+ @skip_with_pyevent
+ @skip_with_zmq
+ def test_fork(self):
+ new_mod = """
+import os
+import eventlet
+server = eventlet.listen(('localhost', 12345))
+t = eventlet.Timeout(0.01)
+try:
+ new_sock, address = server.accept()
+except eventlet.Timeout, t:
+ pass
+
+pid = os.fork()
+if not pid:
+ t = eventlet.Timeout(0.1)
+ try:
+ new_sock, address = server.accept()
+ except eventlet.Timeout, t:
+ print "accept blocked"
+
+else:
+ kpid, status = os.wait()
+ assert kpid == pid
+ assert status == 0
+ print "child died ok"
+"""
+ self.write_to_tempfile("newmod", new_mod)
+ output, lines = self.launch_subprocess('newmod.py')
+ self.assertEqual(len(lines), 3, output)
+ self.assert_("accept blocked" in lines[0])
+ self.assert_("child died ok" in lines[1])
class Foo(object):