summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ftplib.py
diff options
context:
space:
mode:
authorGiampaolo RodolĂ  <g.rodola@gmail.com>2011-03-08 20:33:21 (GMT)
committerGiampaolo RodolĂ  <g.rodola@gmail.com>2011-03-08 20:33:21 (GMT)
commit7a2114719dd7403cacf1e133b2f7414eaab24188 (patch)
treea802e99cac8c0e6ca0730d0d7c7e47dd28455177 /Lib/test/test_ftplib.py
parent684d78cfb022955f1553e10029bf8e4ee2848c75 (diff)
downloadcpython-7a2114719dd7403cacf1e133b2f7414eaab24188.zip
cpython-7a2114719dd7403cacf1e133b2f7414eaab24188.tar.gz
cpython-7a2114719dd7403cacf1e133b2f7414eaab24188.tar.bz2
#8594: fix ResourceWarning in test_ftplib.py - patch by Nadeem Vawda.
Diffstat (limited to 'Lib/test/test_ftplib.py')
-rw-r--r--Lib/test/test_ftplib.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index 5f8a8bd..127b1b9 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -619,8 +619,8 @@ class TestFTPClass(TestCase):
def test_source_address_passive_connection(self):
port = support.find_unused_port()
self.client.source_address = (HOST, port)
- sock = self.client.transfercmd('list')
- self.assertEqual(sock.getsockname()[1], port)
+ with self.client.transfercmd('list') as sock:
+ self.assertEqual(sock.getsockname()[1], port)
def test_parse257(self):
self.assertEqual(ftplib.parse257('257 "/foo/bar"'), '/foo/bar')