diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-09-13 13:09:44 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-09-13 13:09:44 (GMT) |
commit | 769ddb075ac3a840d473930a12a5b72bfbab366f (patch) | |
tree | 5394a535717726adaa85fefbc016369e3dc37651 /Lib/test | |
parent | 6c25b73194714e78975eddea3799f06f3de74647 (diff) | |
download | cpython-769ddb075ac3a840d473930a12a5b72bfbab366f.zip cpython-769ddb075ac3a840d473930a12a5b72bfbab366f.tar.gz cpython-769ddb075ac3a840d473930a12a5b72bfbab366f.tar.bz2 |
[3.6] bpo-31448, test_poplib: Fix ResourceWarning (GH-3542) (#3543)
Call POP3.close(), don't close close directly the sock attribute.
(cherry picked from commit d165e14e29b45a22450263722f5c2c386c3a748a)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_poplib.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index e5b16dc..6bc9739 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -483,7 +483,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()) @@ -493,12 +493,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(): |