diff --git a/mypy.ini b/mypy.ini index a68b8b0e837..d26f652e0fa 100644 --- a/mypy.ini +++ b/mypy.ini @@ -238,21 +238,6 @@ warn_return_any = False # Disable warn_unreachable for some modules until we clean them up -[mypy-twisted.conch.scripts.conch] -warn_unreachable = False - -[mypy-twisted.conch.telnet] -warn_unreachable = False - -[mypy-twisted.conch.test.test_agent] -warn_unreachable = False - -[mypy-twisted.conch.test.test_connection] -warn_unreachable = False - -[mypy-twisted.conch.test.test_ssh] -warn_unreachable = False - [mypy-twisted.internet.defer] warn_unreachable = False diff --git a/src/twisted/conch/scripts/conch.py b/src/twisted/conch/scripts/conch.py index 504eb8c452e..bc7683a6639 100644 --- a/src/twisted/conch/scripts/conch.py +++ b/src/twisted/conch/scripts/conch.py @@ -313,10 +313,6 @@ def serviceStarted(self): conn = self self.localForwards = [] self.remoteForwards = {} - if not isinstance(self, connection.SSHConnection): - # make these fall through - del self.__class__.requestRemoteForwarding - del self.__class__.cancelRemoteForwarding onConnect() def serviceStopped(self): diff --git a/src/twisted/conch/telnet.py b/src/twisted/conch/telnet.py index 6a337f9fe25..a7e36e5988f 100644 --- a/src/twisted/conch/telnet.py +++ b/src/twisted/conch/telnet.py @@ -1015,12 +1015,12 @@ def telnet_NAWS(self, data): linemodeSubcommands = {LINEMODE_SLC: "SLC"} def telnet_LINEMODE(self, data): - linemodeSubcommand = data[0] - if 0: - # XXX TODO: This should be enabled to parse linemode subnegotiation. - getattr(self, "linemode_" + self.linemodeSubcommands[linemodeSubcommand])( - data[1:] - ) + # linemodeSubcommand = data[0] + # # XXX TODO: This should be enabled to parse linemode subnegotiation. + # getattr(self, "linemode_" + self.linemodeSubcommands[linemodeSubcommand])( + # data[1:] + # ) + pass def linemode_SLC(self, data): chunks = zip(*[iter(data)] * 3) diff --git a/src/twisted/conch/test/test_agent.py b/src/twisted/conch/test/test_agent.py index 2a33a5e29f7..cc3a794969c 100644 --- a/src/twisted/conch/test/test_agent.py +++ b/src/twisted/conch/test/test_agent.py @@ -11,19 +11,20 @@ from twisted.test import iosim try: - import cryptography + import cryptography as _cryptography except ImportError: - cryptography = None # type: ignore[assignment] + cryptography = None +else: + cryptography = _cryptography try: - import pyasn1 + import pyasn1 as _pyasn1 except ImportError: pyasn1 = None - -if cryptography and pyasn1: - from twisted.conch.ssh import keys, agent else: - keys = agent = None # type: ignore[assignment] + pyasn1 = _pyasn1 + +from twisted.conch.ssh import keys, agent from twisted.conch.test import keydata from twisted.conch.error import ConchError, MissingKeyStoreError @@ -44,11 +45,6 @@ class AgentTestBase(unittest.TestCase): Tests for SSHAgentServer/Client. """ - if iosim is None: - skip = "iosim requires SSL, but SSL is not available" - elif agent is None or keys is None: - skip = "Cannot run without cryptography or PyASN1" - def setUp(self): # wire up our client <-> server self.client, self.server, self.pump = iosim.connectedServerAndClient( @@ -120,20 +116,18 @@ def test_agentc_REMOVE_ALL_RSA_IDENTITIES(self): return d.addCallback(self.assertEqual, b"") -if agent is not None: - - class CorruptServer(agent.SSHAgentServer): - """ - A misbehaving server that returns bogus response op codes so that we can - verify that our callbacks that deal with these op codes handle such - miscreants. - """ +class CorruptServer(agent.SSHAgentServer): + """ + A misbehaving server that returns bogus response op codes so that we can + verify that our callbacks that deal with these op codes handle such + miscreants. + """ - def agentc_REQUEST_IDENTITIES(self, data): - self.sendResponse(254, b"") + def agentc_REQUEST_IDENTITIES(self, data): + self.sendResponse(254, b"") - def agentc_SIGN_REQUEST(self, data): - self.sendResponse(254, b"") + def agentc_SIGN_REQUEST(self, data): + self.sendResponse(254, b"") class ClientWithBrokenServerTests(AgentTestBase): diff --git a/src/twisted/conch/test/test_connection.py b/src/twisted/conch/test/test_connection.py index fdbd552d8cd..ed7fe6a61ec 100644 --- a/src/twisted/conch/test/test_connection.py +++ b/src/twisted/conch/test/test_connection.py @@ -206,8 +206,6 @@ class ConnectionTests(unittest.TestCase): if not cryptography: skip = "Cannot run without cryptography" - if test_userauth.transport is None: - skip = "Cannot run without both cryptography and pyasn1" def setUp(self): self.transport = test_userauth.FakeTransport(None) @@ -830,9 +828,6 @@ class CleanConnectionShutdownTests(unittest.TestCase): if not cryptography: skip = "Cannot run without cryptography" - if test_userauth.transport is None: - skip = "Cannot run without both cryptography and pyasn1" - def setUp(self): self.transport = test_userauth.FakeTransport(None) self.transport.avatar = TestAvatar() diff --git a/src/twisted/conch/test/test_ssh.py b/src/twisted/conch/test/test_ssh.py index e174e53214d..c0c0d3d2d12 100644 --- a/src/twisted/conch/test/test_ssh.py +++ b/src/twisted/conch/test/test_ssh.py @@ -410,8 +410,6 @@ def receiveError(self, reasonCode, desc): def receiveUnimplemented(self, seqID): raise unittest.FailTest("got unimplemented: seqid %s" % (seqID,)) - self.expectedLoseConnection = 1 - self.loseConnection() class ConchTestServer(ConchTestBase, transport.SSHServerTransport): def connectionLost(self, reason):