# Decides how threads will act upon termination of the
# main process
daemon_threads = False
+ # For non-daemonic threads, list of threading.Threading objects
+ # used by server_close() to wait for all threads completion.
+ _threads = None
def process_request_thread(self, request, client_address):
"""Same as in BaseServer but as a thread.
t = threading.Thread(target = self.process_request_thread,
args = (request, client_address))
t.daemon = self.daemon_threads
+ if not t.daemon:
+ if self._threads is None:
+ self._threads = []
+ self._threads.append(t)
t.start()
+ def server_close(self):
+ super().server_close()
+ threads = self._threads
+ self._threads = None
+ if threads:
+ for thread in threads:
+ thread.join()
+
if hasattr(os, "fork"):
class ForkingUDPServer(ForkingMixIn, UDPServer): pass
self.assertFalse(logger.disabled)
-@unittest.skipIf(True, "FIXME: bpo-30830")
class SocketHandlerTest(BaseTest):
"""Test for SocketHandler objects."""
def tearDown(self):
"""Shutdown the TCP server."""
try:
- if self.server:
- self.server.stop(2.0)
if self.sock_hdlr:
self.root_logger.removeHandler(self.sock_hdlr)
self.sock_hdlr.close()
+ if self.server:
+ self.server.stop(2.0)
finally:
BaseTest.tearDown(self)
os.remove(fn)
return fn
-@unittest.skipIf(True, "FIXME: bpo-30830")
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
class UnixSocketHandlerTest(SocketHandlerTest):
SocketHandlerTest.tearDown(self)
support.unlink(self.address)
-@unittest.skipIf(True, "FIXME: bpo-30830")
class DatagramHandlerTest(BaseTest):
"""Test for DatagramHandler."""
self.handled.wait()
self.assertEqual(self.log_output, "spam\neggs\n")
-@unittest.skipIf(True, "FIXME: bpo-30830")
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
class UnixDatagramHandlerTest(DatagramHandlerTest):
self.handled.wait()
self.assertEqual(self.log_output, b'<11>h\xc3\xa4m-sp\xc3\xa4m')
-@unittest.skipIf(True, "FIXME: bpo-30830")
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
class UnixSysLogHandlerTest(SysLogHandlerTest):
SysLogHandlerTest.tearDown(self)
support.unlink(self.address)
-@unittest.skipIf(True, "FIXME: bpo-30830")
@unittest.skipUnless(support.IPV6_ENABLED,
'IPv6 support required for this test.')
class IPv6SysLogHandlerTest(SysLogHandlerTest):
logging.warning('Exclamation')
self.assertTrue(output.getvalue().endswith('Exclamation!\n'))
- # listen() uses ConfigSocketReceiver which is based
- # on socketserver.ThreadingTCPServer
- @unittest.skipIf(True, "FIXME: bpo-30830")
def setup_via_listener(self, text, verify=None):
text = text.encode("utf-8")
# Ask for a randomly assigned port (by using port 0)