[Python-checkins] bpo-31448, test_poplib: Fix ResourceWarning (#3542)
Victor Stinner
webhook-mailer at python.org
Wed Sep 13 08:53:15 EDT 2017
https://github.com/python/cpython/commit/d165e14e29b45a22450263722f5c2c386c3a748a
commit: d165e14e29b45a22450263722f5c2c386c3a748a
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-09-13T05:53:10-07:00
summary:
bpo-31448, test_poplib: Fix ResourceWarning (#3542)
Call POP3.close(), don't close close directly the sock attribute.
files:
M Lib/test/test_poplib.py
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py
index d7a26bc14c9..721ea252011 100644
--- a/Lib/test/test_poplib.py
+++ b/Lib/test/test_poplib.py
@@ -488,7 +488,7 @@ def testTimeoutDefault(self):
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 @@ def testTimeoutNone(self):
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():
More information about the Python-checkins
mailing list