diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py index a2b1340e0bf5ba..fb2541bff89cf8 100644 --- a/Lib/test/test_urllib2.py +++ b/Lib/test/test_urllib2.py @@ -1791,9 +1791,10 @@ class MyOtherHTTPHandler(urllib.request.HTTPHandler): @unittest.skipUnless(support.is_resource_enabled('network'), 'test requires network access') def test_issue16464(self): - with socket_helper.transient_internet("http://www.example.com/"): + url = "http://httpbin.org/post" + with socket_helper.transient_internet(url): opener = urllib.request.build_opener() - request = urllib.request.Request("http://www.example.com/") + request = urllib.request.Request(url) self.assertEqual(None, request.data) opener.open(request, "1".encode("us-ascii")) diff --git a/Misc/NEWS.d/next/Tests/2022-02-05-18-58-37.bpo-46648.EJUGbT.rst b/Misc/NEWS.d/next/Tests/2022-02-05-18-58-37.bpo-46648.EJUGbT.rst new file mode 100644 index 00000000000000..970b798a576a98 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2022-02-05-18-58-37.bpo-46648.EJUGbT.rst @@ -0,0 +1,3 @@ +The test_issue16464() test of test_urllib2 now uses +``http://httpbin.org/post`` URL instead of ``http://www.example.com/``. +Patch by Victor Stinner.