some tests will fail on macOS when have a system proxy such as test_urllib2_localnet test_urllib2net
Đang mở
Chưa có ai nhận issue này.
OS-mac
tests
type-bug
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Bug report
Bug description:
reproduce
make macOS a system proxy(not http_proxy https_proxy in env but at system)
➜ cpython git:(main) echo $http_proxy
➜ cpython git:(main) ./python.exe -c 'import urllib.request;print(urllib.request.getproxies())'
{'http': 'http://127.0.0.1:7897', 'https': 'http://127.0.0.1:7897', 'socks': 'http://127.0.0.1:7897'}
some of the error is because we only add no_proxy for env(in tests)
but macOS maybe have a system one
some bt
Ran 2 tests in 1.697s
FAILED (errors=2)
Warning -- Unraisable exception
Exception ignored while finalizing socket <socket.socket [closed] fd=3, family=2, type=1, proto=6>:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 165, in _load_run_test
regrtest_runner(result, test_func, runtests)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 118, in regrtest_runner
test_result = test_func()
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 162, in test_func
return run_unittest(test_mod, runtests)
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 42, in run_unittest
return _run_suite(tests)
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 105, in _run_suite
raise support.TestFailedWithDetails(err, errors, failures, stats=stats)
test.support.TestFailedWithDetails: multiple errors occurred
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/test/support/__init__.py", line 847, in gc_collect
gc.collect()
~~~~~~~~~~^^
ResourceWarning: unclosed <socket.socket [closed] fd=3, family=2, type=1, proto=6>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _TemporaryFileCloser.__del__ at 0x105d07950>:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 165, in _load_run_test
regrtest_runner(result, test_func, runtests)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 118, in regrtest_runner
test_result = test_func()
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 162, in test_func
return run_unittest(test_mod, runtests)
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 42, in run_unittest
return _run_suite(tests)
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 105, in _run_suite
raise support.TestFailedWithDetails(err, errors, failures, stats=stats)
test.support.TestFailedWithDetails: multiple errors occurred
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/tempfile.py", line 484, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: Implicitly cleaning up <HTTPError 404: 'Not Found'>
Warning -- Unraisable exception
Exception ignored while finalizing socket <socket.socket [closed] fd=4, family=2, type=1, proto=6>:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 165, in _load_run_test
regrtest_runner(result, test_func, runtests)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 118, in regrtest_runner
test_result = test_func()
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 162, in test_func
return run_unittest(test_mod, runtests)
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 42, in run_unittest
return _run_suite(tests)
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 105, in _run_suite
raise support.TestFailedWithDetails(err, errors, failures, stats=stats)
test.support.TestFailedWithDetails: multiple errors occurred
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/test/support/__init__.py", line 847, in gc_collect
gc.collect()
~~~~~~~~~~^^
ResourceWarning: unclosed <socket.socket [closed] fd=4, family=2, type=1, proto=6>
Warning -- Unraisable exception
Exception ignored while calling deallocator <function _TemporaryFileCloser.__del__ at 0x105d07950>:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 165, in _load_run_test
regrtest_runner(result, test_func, runtests)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 118, in regrtest_runner
test_result = test_func()
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 162, in test_func
return run_unittest(test_mod, runtests)
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 42, in run_unittest
return _run_suite(tests)
File "/Users/hyi/prs/cpython/Lib/test/libregrtest/single.py", line 105, in _run_suite
raise support.TestFailedWithDetails(err, errors, failures, stats=stats)
test.support.TestFailedWithDetails: multiple errors occurred
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/tempfile.py", line 484, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: Implicitly cleaning up <HTTPError 404: 'Not Found'>
test test_urllib2net failed
0:02:07 load avg: 8.33 [5/5/5] test_urllibnet failed (env changed)
Re-running test_urllibnet in verbose mode
testURLread (test.test_urllibnet.URLTimeoutTest.testURLread) ... ok
test_bad_address (test.test_urllibnet.urlopenNetworkTests.test_bad_address) ... Warning -- Unraisable exception
Exception ignored while calling deallocator <function _TemporaryFileCloser.__del__ at 0x1030bb950>:
Traceback (most recent call last):
File "/Users/hyi/prs/cpython/Lib/tempfile.py", line 484, in __del__
_warnings.warn(self.warn_message, ResourceWarning)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ResourceWarning: Implicitly cleaning up <HTTPError 502: 'Bad Gateway'>
ok
test_basic (test.test_urllibnet.urlopenNetworkTests.test_basic) ... ok
test_getcode (test.test_urllibnet.urlopenNetworkTests.test_getcode) ... ok
test_geturl (test.test_urllibnet.urlopenNetworkTests.test_geturl) ... ok
test_info (test.test_urllibnet.urlopenNetworkTests.test_info) ... ok
test_readlines (test.test_urllibnet.urlopenNetworkTests.test_readlines) ... ok
test_basic (test.test_urllibnet.urlretrieveNetworkTests.test_basic) ... ok
test_data_header (test.test_urllibnet.urlretrieveNetworkTests.test_data_header) ... ok
test_header (test.test_urllibnet.urlretrieveNetworkTests.test_header) ... ok
test_reporthook (test.test_urllibnet.urlretrieveNetworkTests.test_reporthook) ... ok
test_specified_path (test.test_urllibnet.urlretrieveNetworkTests.test_specified_path) ... ok
----------------------------------------------------------------------
Ran 12 tests in 7.103s
OK
4 tests failed again:
test_urllib test_urllib2 test_urllib2_localnet test_urllib2net
== Tests result: FAILURE then FAILURE ==
10 slowest tests:
- test_smtpnet: 1 min 10 sec
- test_signal: 48.5 sec
- test.test_multiprocessing_spawn.test_processes: 30.4 sec
- test.test_multiprocessing_forkserver.test_processes: 29.7 sec
- test_socket: 29.1 sec
- test_urllib2net: 28.4 sec
- test_xmlrpc: 27.3 sec
- test.test_concurrent_futures.test_process_pool: 26.3 sec
- test_logging: 25.0 sec
- test.test_io.test_signals: 24.4 sec
31 tests skipped:
test.test_asyncio.test_windows_events
test.test_asyncio.test_windows_utils test.test_gdb.test_backtrace
test.test_gdb.test_cfunction test.test_gdb.test_cfunction_full
test.test_gdb.test_misc test.test_gdb.test_pretty_print
test.test_multiprocessing_fork.test_manager
test.test_multiprocessing_fork.test_misc
test.test_multiprocessing_fork.test_processes
test.test_multiprocessing_fork.test_threads
test.test_os.test_windows test_android test_dbm_gnu test_devpoll
test_epoll test_free_threading test_idle test_launcher test_msvcrt
test_startfile test_tcl test_tkinter test_ttk test_ttk_textonly
test_turtle test_winapi test_winconsoleio test_winreg
test_winsound test_wmi
2 tests skipped (resource denied):
test_peg_generator test_zipfile64
1 test altered the execution environment (env changed):
test_urllibnet
5 re-run tests:
test_urllib test_urllib2 test_urllib2_localnet test_urllib2net
test_urllibnet
4 tests failed:
test_urllib test_urllib2 test_urllib2_localnet test_urllib2net
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-140144
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với các test có tên test_urllib2_localnet và test_urllib2net, sau đó kiểm tra cách các test urllib cấu hình no_proxy và lấy proxy hệ thống trên macOS. Tái hiện với proxy hệ thống trên macOS và chạy các test urllib được liệt kê; hoàn tất khi các test này vượt qua mà không có lỗi liên quan đến proxy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- networking
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100