diff --git a/Lib/test/test_urllib.py b/Lib/test/test_urllib.py index 7214492eca9d88..1ff6290c904210 100644 --- a/Lib/test/test_urllib.py +++ b/Lib/test/test_urllib.py @@ -402,6 +402,8 @@ def test_read_bogus(self): Content-Type: text/html; charset=iso-8859-1 ''') try: + # Silence destructor error + http.client.HTTPConnection.close = lambda self: None self.assertRaises(OSError, urlopen, "http://python.org/") finally: self.unfakehttp() @@ -416,6 +418,8 @@ def test_invalid_redirect(self): Content-Type: text/html; charset=iso-8859-1 ''') try: + # Silence destructor error + http.client.HTTPConnection.close = lambda self: None msg = "Redirection to url 'file:" with self.assertRaisesRegex(urllib.error.HTTPError, msg): urlopen("http://python.org/") @@ -431,6 +435,8 @@ def test_redirect_limit_independent(self): Connection: close ''') try: + # Silence destructor error + http.client.HTTPConnection.close = lambda self: None self.assertRaises(urllib.error.HTTPError, urlopen, "http://something") finally: