Issue #6623: Remove deprecated Netrc class in the ftplib module.

Patch by Matt Chaput.
This commit is contained in:
Berker Peksag 2014-11-01 10:45:57 +02:00
parent 8906f14a68
commit 8f791d358b
5 changed files with 23 additions and 129 deletions

View file

@ -76,7 +76,7 @@ class DummyDTPHandler(asynchat.async_chat):
super(DummyDTPHandler, self).push(what.encode('ascii'))
def handle_error(self):
raise
raise Exception
class DummyFTPHandler(asynchat.async_chat):
@ -121,7 +121,7 @@ class DummyFTPHandler(asynchat.async_chat):
self.push('550 command "%s" not understood.' %cmd)
def handle_error(self):
raise
raise Exception
def push(self, data):
asynchat.async_chat.push(self, data.encode('ascii') + b'\r\n')
@ -299,7 +299,7 @@ class DummyFTPServer(asyncore.dispatcher, threading.Thread):
return 0
def handle_error(self):
raise
raise Exception
if ssl is not None:
@ -397,7 +397,7 @@ if ssl is not None:
raise
def handle_error(self):
raise
raise Exception
def close(self):
if (isinstance(self.socket, ssl.SSLSocket) and
@ -673,7 +673,7 @@ class TestFTPClass(TestCase):
self.assertRaises(StopIteration, next, self.client.mlsd())
set_data('')
for x in self.client.mlsd():
self.fail("unexpected data %s" % data)
self.fail("unexpected data %s" % x)
def test_makeport(self):
with self.client.makeport():
@ -1053,19 +1053,8 @@ class TestTimeouts(TestCase):
ftp.close()
class TestNetrcDeprecation(TestCase):
def test_deprecation(self):
with support.temp_cwd(), support.EnvironmentVarGuard() as env:
env['HOME'] = os.getcwd()
open('.netrc', 'w').close()
with self.assertWarns(DeprecationWarning):
ftplib.Netrc()
def test_main():
tests = [TestFTPClass, TestTimeouts, TestNetrcDeprecation,
tests = [TestFTPClass, TestTimeouts,
TestIPv6Environment,
TestTLS_FTPClassMixin, TestTLS_FTPClass]