summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-05-02 11:12:02 (GMT)
committerGitHub <noreply@github.com>2017-05-02 11:12:02 (GMT)
commit1dae7450c68bad498e57800387b24cb103c461fa (patch)
tree89b3558e121bb13d75f0eb5d177ea1763cf58bcc /Lib/test/test_ssl.py
parent92fd6c9ef54a857815e3dca8ee74b2b4f5cdf154 (diff)
downloadcpython-1dae7450c68bad498e57800387b24cb103c461fa.zip
cpython-1dae7450c68bad498e57800387b24cb103c461fa.tar.gz
cpython-1dae7450c68bad498e57800387b24cb103c461fa.tar.bz2
bpo-30199: test_ssl closes all asyncore channels (#1381)
AsyncoreEchoServer of test_ssl now calls asyncore.close_all(ignore_all=True) to ensure that asyncore.socket_map is cleared once the test completes, even if ConnectionHandler was not correctly unregistered. Fix the following warning: Warning -- asyncore.socket_map was modified by test_ssl Before: {} After: {6: <test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler>}
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 69a65d2..8dcd3b6 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2064,7 +2064,7 @@ if _have_threads:
class EchoServer (asyncore.dispatcher):
- class ConnectionHandler (asyncore.dispatcher_with_send):
+ class ConnectionHandler(asyncore.dispatcher_with_send):
def __init__(self, conn, certfile):
self.socket = test_wrap_socket(conn, server_side=True,
@@ -2155,6 +2155,8 @@ if _have_threads:
self.join()
if support.verbose:
sys.stdout.write(" cleanup: successfully joined.\n")
+ # make sure that ConnectionHandler is removed from socket_map
+ asyncore.close_all(ignore_all=True)
def start (self, flag=None):
self.flag = flag