Blob Blame History Raw
From b8f390574e3cef7fb4abb111fa75f0d9d8ea9f5f Mon Sep 17 00:00:00 2001
From: Mark Williams <mrw@enotuniq.org>
Date: Sun, 10 Feb 2019 16:26:51 -0800
Subject: [PATCH] Remove checks for previous TLS implementation.

Before https://twistedmatrix.com/trac/ticket/4854, Twisted's TLS
implementation didn't use memory BIOs; after an implementation was
introduced that did, there were differences between the two that led
these tests to check which one was used.

Now there's only the memory BIO implementation, so we can remove code
that checks for the previous implementation.
---
 src/twisted/test/test_ssl.py | 27 ---------------------------
 1 file changed, 27 deletions(-)

diff --git a/src/twisted/test/test_ssl.py b/src/twisted/test/test_ssl.py
index 1f3375e010..d580573627 100644
--- a/src/twisted/test/test_ssl.py
+++ b/src/twisted/test/test_ssl.py
@@ -11,7 +11,6 @@
 from twisted.internet import protocol, reactor, interfaces, defer
 from twisted.internet.error import ConnectionDone
 from twisted.protocols import basic
-from twisted.python.reflect import requireModule
 from twisted.python.runtime import platform
 from twisted.test.test_tcp import ProperlyCloseFilesMixin
 from twisted.test.proto_helpers import waitUntilAllDisconnected
@@ -30,12 +29,6 @@ def _noSSL():
         SSL = ssl = None
     _noSSL()
 
-try:
-    from twisted.protocols import tls as newTLS
-except ImportError:
-    # Assuming SSL exists, we're using old version in reactor (i.e. non-protocol)
-    newTLS = None
-
 from zope.interface import implementer
 
 class UnintelligentProtocol(basic.LineReceiver):
@@ -316,23 +309,6 @@ def getHandleErrorCode(self):
         detail. It would be better if this test worked in a way which did not
         require this.
         """
-        # Windows 2000 SP 4 and Windows XP SP 2 give back WSAENOTSOCK for
-        # SSL.Connection.write for some reason.  The twisted.protocols.tls
-        # implementation of IReactorSSL doesn't suffer from this imprecation,
-        # though, since it is isolated from the Windows I/O layer (I suppose?).
-
-        # If test_properlyCloseFiles waited for the SSL handshake to complete
-        # and performed an orderly shutdown, then this would probably be a
-        # little less weird: writing to a shutdown SSL connection has a more
-        # well-defined failure mode (or at least it should).
-
-        # So figure out if twisted.protocols.tls is in use.  If it can be
-        # imported, it should be.
-        if requireModule('twisted.protocols.tls') is None:
-            # It isn't available, so we expect WSAENOTSOCK if we're on Windows.
-            if platform.getType() == 'win32':
-                return errno.WSAENOTSOCK
-
         # Otherwise, we expect an error about how we tried to write to a
         # shutdown connection.  This is terribly implementation-specific.
         return [('SSL routines', 'SSL_write', 'protocol is shutdown')]
@@ -564,9 +540,6 @@ def checkResult(failure):
             [clientProtocol.done.addErrback(checkResult),
              serverProtocol.done.addErrback(checkResult)])
 
-    if newTLS is None:
-        test_bothSidesLoseConnection.skip = "Old SSL code doesn't always close cleanly."
-
 
     def testFailedVerify(self):
         org = "twisted.test.test_ssl"