From bb93f4bb0da95a244a1633583a5ad36e6f785de3 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Tue, 20 Jun 2006 17:30:26 +0000 Subject: [PATCH] Raise TestSkipped when the test socket connection is refused. --- Lib/test/test_socket_ssl.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/test/test_socket_ssl.py b/Lib/test/test_socket_ssl.py index 074b6279fe..fb840561b1 100644 --- a/Lib/test/test_socket_ssl.py +++ b/Lib/test/test_socket_ssl.py @@ -3,6 +3,7 @@ import sys from test import test_support import socket +import errno # Optionally test SSL support. This requires the 'network' resource as given # on the regrtest command line. @@ -54,6 +55,12 @@ def test_timeout(): for. If this message is seen often, test_timeout should be changed to use a more reliable address.""" % (ADDR,) return + except socket.err, exc: # In case connection is refused. + if (isinstance(exc.message, tuple) and + exc.message[0] == errno.ECONNREFUSED): + raise test_support.TestSkipped("test socket connection refused") + else: + raise exc ss = socket.ssl(s) # Read part of return welcome banner twice. -- 2.40.0