Skip to content

Commit c645167

Browse files
committed
Close the HTTPError raised in the new tests
regrtest reports the unclosed response as an env change.
1 parent 8c45110 commit c645167

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/test/test_urllib2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,8 +1783,9 @@ def http_open(self, req):
17831783
opener = OpenerDirector()
17841784
opener.add_handler(auth_handler)
17851785
opener.add_handler(MockDigestHTTPHandler())
1786-
with self.assertRaises(urllib.error.HTTPError):
1786+
with self.assertRaises(urllib.error.HTTPError) as cm:
17871787
opener.open("http://acme.example.com/protected")
1788+
cm.exception.close()
17881789

17891790
# The same handler must still authenticate a later request.
17901791
opener = OpenerDirector()

0 commit comments

Comments
 (0)