summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_socketserver.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-08-10 13:28:16 (GMT)
committerGitHub <noreply@github.com>2017-08-10 13:28:16 (GMT)
commitaa8ec34ad52bb3b274ce91169e1bc4a598655049 (patch)
tree4c1a82ebac934277dcdec6ba16b62c858df1b539 /Lib/test/test_socketserver.py
parent6c8c2943d996b59a48d331f61f22cbe72933910e (diff)
downloadcpython-aa8ec34ad52bb3b274ce91169e1bc4a598655049.zip
cpython-aa8ec34ad52bb3b274ce91169e1bc4a598655049.tar.gz
cpython-aa8ec34ad52bb3b274ce91169e1bc4a598655049.tar.bz2
bpo-31151: Add socketserver.ForkingMixIn.server_close() (#3057)
* Add socketserver.ForkingMixIn.server_close() bpo-31151: socketserver.ForkingMixIn.server_close() now waits until all child processes completed to prevent leaking zombie processes. * Fix test on Windows which doesn't have ForkingMixIn
Diffstat (limited to 'Lib/test/test_socketserver.py')
-rw-r--r--Lib/test/test_socketserver.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py
index 140a6ab..3d93566 100644
--- a/Lib/test/test_socketserver.py
+++ b/Lib/test/test_socketserver.py
@@ -144,6 +144,10 @@ class SocketServerTest(unittest.TestCase):
t.join()
server.server_close()
self.assertEqual(-1, server.socket.fileno())
+ if HAVE_FORKING and isinstance(server, socketserver.ForkingMixIn):
+ # bpo-31151: Check that ForkingMixIn.server_close() waits until
+ # all children completed
+ self.assertFalse(server.active_children)
if verbose: print("done")
def stream_examine(self, proto, addr):
@@ -371,10 +375,7 @@ class ThreadingErrorTestServer(socketserver.ThreadingMixIn,
if HAVE_FORKING:
class ForkingErrorTestServer(socketserver.ForkingMixIn, BaseErrorTestServer):
- def wait_done(self):
- [child] = self.active_children
- os.waitpid(child, 0)
- self.active_children.clear()
+ pass
class SocketWriterTest(unittest.TestCase):