This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_urllib2.test_issue16464() fails randomly
Type: Stage: resolved
Components: Tests Versions: Python 3.11
process
Status: closed Resolution: duplicate
Dependencies: Superseder: `test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection
View: 46648
Assigned To: Nosy List: vstinner
Priority: normal Keywords:

Created on 2022-02-05 17:57 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg412586 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-02-05 17:57
test_urllib2.test_issue16464() fails randomly.

It uses http://www.example.com/ server.

Instead, I proposed to use http://httpbin.org/post URL which is written to support HTTP POST.

$ ./python -m test test_urllib2 -u all -v -m test_issue16464
======================================================================
ERROR: test_issue16464 (test.test_urllib2.MiscTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/test/support/socket_helper.py", line 245, in transient_internet
    yield
    ^^^^^
  File "/home/vstinner/python/main/Lib/test/test_urllib2.py", line 1799, in test_issue16464
    opener.open(request, "1".encode("us-ascii"))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/urllib/request.py", line 525, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/urllib/request.py", line 634, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/urllib/request.py", line 563, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/urllib/request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/home/vstinner/python/main/Lib/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib.error.HTTPError: HTTP Error 404: Not Found
msg412587 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-02-05 17:59
Oh, bpo-46648 was already opened.
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90809
2022-02-05 17:59:58vstinnersetstatus: open -> closed
superseder: `test.test_urllib2.MiscTests.test_issue16464` flaky due to external connection
messages: + msg412587

resolution: duplicate
stage: resolved
2022-02-05 17:57:15vstinnercreate