[3.12] gh-128734: Explicitly close sockets in urllib tests (GH-128735) (GH-128750)

(cherry picked from commit 5ace71713b)
This commit is contained in:
Serhiy Storchaka 2025-01-12 13:30:07 +02:00 committed by GitHub
parent a600439e42
commit c20c551ce3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 19 deletions

View file

@ -48,6 +48,7 @@ class TestResponse(unittest.TestCase):
info = urllib.response.addinfo(self.fp, self.test_headers)
self.assertEqual(info.info(), self.test_headers)
self.assertEqual(info.headers, self.test_headers)
info.close()
def test_addinfourl(self):
url = "http://www.python.org"
@ -60,6 +61,7 @@ class TestResponse(unittest.TestCase):
self.assertEqual(infourl.headers, self.test_headers)
self.assertEqual(infourl.url, url)
self.assertEqual(infourl.status, code)
infourl.close()
def tearDown(self):
self.sock.close()