python / cpython

The Python programming language
https://www.python.org
Other
63.18k stars 30.25k forks source link

test_urllib2_localnet fails in macOS 13.1 #102423

Closed uyw4687 closed 1 year ago

uyw4687 commented 1 year ago

Bug report

A clear and concise description of what the bug is. Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.

test_urllib2_localnet fails in macOS 13.1

Your environment

log of make test

0:02:37 load avg: 9.04 [432/434/2] test_tokenize passed (40.0 sec) -- running: test_multiprocessing_spawn (1 min 40 sec), test_math (51.7 sec)
0:02:47 load avg: 8.10 [433/434/2] test_multiprocessing_spawn passed (1 min 49 sec) -- running: test_math (1 min 1 sec)
0:02:57 load avg: 7.61 [434/434/2] test_math passed (1 min 10 sec)

== Tests result: FAILURE ==

411 tests OK.

2 tests failed:
    test_tools test_urllib2_localnet

21 tests skipped:
    test_check_c_globals test_devpoll test_epoll test_gdb test_ioctl
    test_launcher test_msilib test_multiprocessing_fork
    test_ossaudiodev test_peg_generator test_perf_profiler test_spwd
    test_startfile test_tix test_tkinter test_ttk test_winconsoleio
    test_winreg test_winsound test_wmi test_zipfile64
0:02:57 load avg: 7.61
0:02:57 load avg: 7.61 Re-running failed tests in verbose mode
0:02:57 load avg: 7.61 Re-running test_urllib2_localnet in verbose mode (matching: test_proxy_qop_auth_works, test_proxy_with_bad_password_raises_httperror, test_proxy_with_no_password_raises_httperror)
test_proxy_qop_auth_works (test.test_urllib2_localnet.ProxyAuthTests.test_proxy_qop_auth_works) ... ERROR
test_proxy_with_bad_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests.test_proxy_with_bad_password_raises_httperror) ... ERROR
test_proxy_with_no_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests.test_proxy_with_no_password_raises_httperror) ... ERROR

======================================================================
ERROR: test_proxy_qop_auth_works (test.test_urllib2_localnet.ProxyAuthTests.test_proxy_qop_auth_works)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1344, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1286, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1332, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1281, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1041, in _send_output
    self.send(msg)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 985, in send
    self.connect()
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 951, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/socket.py", line 852, in create_connection
    raise exceptions[0]
  File "/Users/user/PycharmProjects/cpython/Lib/socket.py", line 837, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/PycharmProjects/cpython/Lib/test/test_urllib2_localnet.py", line 380, in test_proxy_qop_auth_works
    with self.opener.open(self.URL) as result:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 515, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 532, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1373, in http_open
    return self.do_open(http.client.HTTPConnection, req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1347, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 61] Connection refused>

======================================================================
ERROR: test_proxy_with_bad_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests.test_proxy_with_bad_password_raises_httperror)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1344, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1286, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1332, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1281, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1041, in _send_output
    self.send(msg)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 985, in send
    self.connect()
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 951, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/socket.py", line 852, in create_connection
    raise exceptions[0]
  File "/Users/user/PycharmProjects/cpython/Lib/socket.py", line 837, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/PycharmProjects/cpython/Lib/test/test_urllib2_localnet.py", line 366, in test_proxy_with_bad_password_raises_httperror
    self.assertRaises(urllib.error.HTTPError,
  File "/Users/user/PycharmProjects/cpython/Lib/unittest/case.py", line 766, in assertRaises
    return context.handle('assertRaises', args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/unittest/case.py", line 237, in handle
    callable_obj(*args, **kwargs)
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 515, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 532, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1373, in http_open
    return self.do_open(http.client.HTTPConnection, req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1347, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 61] Connection refused>

======================================================================
ERROR: test_proxy_with_no_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests.test_proxy_with_no_password_raises_httperror)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1344, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1286, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1332, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1281, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 1041, in _send_output
    self.send(msg)
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 985, in send
    self.connect()
  File "/Users/user/PycharmProjects/cpython/Lib/http/client.py", line 951, in connect
    self.sock = self._create_connection(
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/socket.py", line 852, in create_connection
    raise exceptions[0]
  File "/Users/user/PycharmProjects/cpython/Lib/socket.py", line 837, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/PycharmProjects/cpython/Lib/test/test_urllib2_localnet.py", line 372, in test_proxy_with_no_password_raises_httperror
    self.assertRaises(urllib.error.HTTPError,
  File "/Users/user/PycharmProjects/cpython/Lib/unittest/case.py", line 766, in assertRaises
    return context.handle('assertRaises', args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/unittest/case.py", line 237, in handle
    callable_obj(*args, **kwargs)
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 515, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 532, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1373, in http_open
    return self.do_open(http.client.HTTPConnection, req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/PycharmProjects/cpython/Lib/urllib/request.py", line 1347, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 61] Connection refused>

----------------------------------------------------------------------
Ran 3 tests in 0.311s

FAILED (errors=3)
test test_urllib2_localnet failed
0:02:57 load avg: 7.61 Re-running test_tools in verbose mode (matching: test_freeze_simple_script)
test_freeze_simple_script (test.test_tools.test_freeze.TestFreeze.test_freeze_simple_script) ... creating the script to be frozen at /private/var/folders/gw/qbl1jnf1401320_xg5wv_3740000gn/T/tmpsr1kia6l/app.py
copying the source tree into /private/var/folders/gw/qbl1jnf1401320_xg5wv_3740000gn/T/tmpsr1kia6l/cpython...
configuring python in /private/var/folders/gw/qbl1jnf1401320_xg5wv_3740000gn/T/tmpsr1kia6l/python-build...
building python parallel='-j6' in /private/var/folders/gw/qbl1jnf1401320_xg5wv_3740000gn/T/tmpsr1kia6l/python-build...
installing python into /private/var/folders/gw/qbl1jnf1401320_xg5wv_3740000gn/T/tmpsr1kia6l/python-installation...
freezing /private/var/folders/gw/qbl1jnf1401320_xg5wv_3740000gn/T/tmpsr1kia6l/app.py...
ok

----------------------------------------------------------------------
Ran 1 test in 103.133s

OK
1 test failed again:
    test_urllib2_localnet

== Tests result: FAILURE then FAILURE ==

412 tests OK.

1 test failed:
    test_urllib2_localnet

21 tests skipped:
    test_check_c_globals test_devpoll test_epoll test_gdb test_ioctl
    test_launcher test_msilib test_multiprocessing_fork
    test_ossaudiodev test_peg_generator test_perf_profiler test_spwd
    test_startfile test_tix test_tkinter test_ttk test_winconsoleio
    test_winreg test_winsound test_wmi test_zipfile64

2 re-run tests:
    test_tools test_urllib2_localnet

Total duration: 4 min 40 sec
Tests result: FAILURE then FAILURE
make: *** [test] Error 2
hugovk commented 1 year ago

I just tried twice (macOS Ventura 13.2.1, Apple M1 Pro) and it passed both times.

urllib.error.URLError: <urlopen error [Errno 61] Connection refused> is probably just a temporary network error, want to try again?