summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_poplib.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-09-13 12:53:10 (GMT)
committerGitHub <noreply@github.com>2017-09-13 12:53:10 (GMT)
commitd165e14e29b45a22450263722f5c2c386c3a748a (patch)
tree668b0f6bd988e143b78d09ef43212b1adc2e3147 /Lib/test/test_poplib.py
parenta7b3bc554c6fdc868accc1480038712c74354b42 (diff)
downloadcpython-d165e14e29b45a22450263722f5c2c386c3a748a.zip
cpython-d165e14e29b45a22450263722f5c2c386c3a748a.tar.gz
cpython-d165e14e29b45a22450263722f5c2c386c3a748a.tar.bz2
bpo-31448, test_poplib: Fix ResourceWarning (#3542)
Call POP3.close(), don't close close directly the sock attribute.
Diffstat (limited to 'Lib/test/test_poplib.py')
-rw-r--r--Lib/test/test_poplib.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py
index d7a26bc..721ea25 100644
--- a/Lib/test/test_poplib.py
+++ b/Lib/test/test_poplib.py
@@ -488,7 +488,7 @@ class TestTimeouts(TestCase):
finally:
socket.setdefaulttimeout(None)
self.assertEqual(pop.sock.gettimeout(), 30)
- pop.sock.close()
+ pop.close()
def testTimeoutNone(self):
self.assertIsNone(socket.getdefaulttimeout())
@@ -498,12 +498,12 @@ class TestTimeouts(TestCase):
finally:
socket.setdefaulttimeout(None)
self.assertIsNone(pop.sock.gettimeout())
- pop.sock.close()
+ pop.close()
def testTimeoutValue(self):
pop = poplib.POP3(HOST, self.port, timeout=30)
self.assertEqual(pop.sock.gettimeout(), 30)
- pop.sock.close()
+ pop.close()
def test_main():