Kaydet (Commit) d165e14e authored tarafından Victor Stinner's avatar Victor Stinner Kaydeden (comit) GitHub

bpo-31448, test_poplib: Fix ResourceWarning (#3542)

Call POP3.close(), don't close close directly the sock attribute.
üst a7b3bc55
......@@ -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():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment