Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures and hang with PyPy3.10 7.3.16 #1429

Open
mgorny opened this issue Jun 22, 2024 · 0 comments
Open

Test failures and hang with PyPy3.10 7.3.16 #1429

mgorny opened this issue Jun 22, 2024 · 0 comments
Assignees
Labels
Bug Bug report in proxy server

Comments

@mgorny
Copy link

mgorny commented Jun 22, 2024

Describe the bug
When running the test suite with PyPy3.10 7.3.16, the following test hangs, and triggers a timeout that causes pytest to hang entirely:

tests/core/test_event_dispatcher.py::TestEventDispatcher::test_unsubscribe Timeout (0:02:00)!
Thread 0x7F98C2C006C0 (most recent call first, approximate line numbers):
  File "/usr/lib/pypy3.10/socket.py", line 286 in accept
  File "/usr/lib/pypy3.10/multiprocessing/connection.py", line 608 in accept
  File "/usr/lib/pypy3.10/multiprocessing/connection.py", line 455 in accept
  File "/usr/lib/pypy3.10/multiprocessing/resource_sharer.py", line 133 in _serve
  File "/usr/lib/pypy3.10/threading.py", line 942 in run
  File "/usr/lib/pypy3.10/threading.py", line 999 in _bootstrap_inner
  File "/usr/lib/pypy3.10/threading.py", line 959 in _bootstrap

Thread 0x7F98CA661BC0 (most recent call first, approximate line numbers):
  File "/usr/lib/pypy3.10/multiprocessing/connection.py", line 374 in _recv
  File "/usr/lib/pypy3.10/multiprocessing/connection.py", line 413 in _recv_bytes
  File "/usr/lib/pypy3.10/multiprocessing/connection.py", line 246 in recv
  File "/tmp/proxy.py/tests/core/test_event_dispatcher.py", line 90 in test_unsubscribe
  File "/usr/lib/pypy3.10/unittest/case.py", line 548 in _callTestMethod
  File "/usr/lib/pypy3.10/unittest/case.py", line 557 in run
  File "/usr/lib/pypy3.10/unittest/case.py", line 649 in __call__
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/unittest.py", line 301 in runtest
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/runner.py", line 159 in pytest_runtest_call
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_callers.py", line 53 in _multicall
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_manager.py", line 111 in _hookexec
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_hooks.py", line 498 in __call__
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/runner.py", line 261 in <lambda>
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/runner.py", line 317 in from_call
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/runner.py", line 246 in call_runtest_hook
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/runner.py", line 218 in call_and_report
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/runner.py", line 118 in runtestprotocol
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/runner.py", line 110 in pytest_runtest_protocol
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_callers.py", line 53 in _multicall
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_manager.py", line 111 in _hookexec
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_hooks.py", line 498 in __call__
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/main.py", line 335 in pytest_runtestloop
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_callers.py", line 53 in _multicall
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_manager.py", line 111 in _hookexec
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_hooks.py", line 498 in __call__
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/main.py", line 318 in _main
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/main.py", line 255 in wrap_session
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/main.py", line 314 in pytest_cmdline_main
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_callers.py", line 53 in _multicall
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_manager.py", line 111 in _hookexec
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/pluggy/_hooks.py", line 498 in __call__
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/config/__init__.py", line 133 in main
  File "/tmp/proxy.py/.tox/pypy310/lib/pypy3.10/site-packages/_pytest/config/__init__.py", line 181 in console_main
  File "/tmp/proxy.py/.tox/pypy310/bin/pytest", line 1 in <module>
  File "<builtin>/app_main.py", line 1035 in execfile
  File "<builtin>/app_main.py", line 133 in run_toplevel
  File "<builtin>/app_main.py", line 748 in run_command_line
  File "<builtin>/app_main.py", line 1149 in entry_point

If I deselect it (and integration tests per #1426), I get the following failures:

============================= test session starts ==============================
platform linux -- Python 3.10.14[pypy-7.3.16-final], pytest-7.0.1, pluggy-1.5.0 -- /tmp/proxy.py/.tox/pypy310/bin/python
cachedir: .pytest_cache
rootdir: /tmp/proxy.py, configfile: pytest.ini, testpaths: tests/
plugins: cov-3.0.0, anyio-3.7.1, mock-3.6.1, forked-1.6.0, asyncio-0.16.0, xdist-2.5.0
collecting ... collected 222 items / 1 deselected / 221 selected

tests/test_main.py::TestMain::test_enable_dashboard PASSED               [  0%]
tests/test_main.py::TestMain::test_enable_devtools PASSED                [  0%]
tests/test_main.py::TestMain::test_enable_events FAILED                  [  1%]
tests/test_main.py::TestMain::test_enable_ssh_tunnel PASSED              [  1%]
tests/test_main.py::TestMain::test_entry_point PASSED                    [  2%]
tests/test_main.py::TestMain::test_main_with_no_flags FAILED             [  2%]
tests/test_main.py::TestProxyContextManager::test_proxy_context_manager PASSED [  3%]
tests/test_set_open_file_limit.py::TestSetOpenFileLimit::test_set_open_file_limit PASSED [  3%]
tests/test_set_open_file_limit.py::TestSetOpenFileLimit::test_set_open_file_limit_not_called PASSED [  4%]
tests/test_set_open_file_limit.py::TestSetOpenFileLimit::test_set_open_file_limit_not_called_coz_upper_bound_check PASSED [  4%]
tests/common/test_flags.py::TestFlags::test_basic_auth_flag_is_base64_encoded PASSED [  4%]
tests/common/test_flags.py::TestFlags::test_load_plugin_from_args PASSED [  5%]
tests/common/test_flags.py::TestFlags::test_load_plugin_from_bytes PASSED [  5%]
tests/common/test_flags.py::TestFlags::test_load_plugin_from_class PASSED [  6%]
tests/common/test_flags.py::TestFlags::test_load_plugins_from_args PASSED [  6%]
tests/common/test_flags.py::TestFlags::test_load_plugins_from_bytes PASSED [  7%]
tests/common/test_flags.py::TestFlags::test_load_plugins_from_bytes_and_class PASSED [  7%]
tests/common/test_flags.py::TestFlags::test_load_plugins_from_class PASSED [  8%]
tests/common/test_flags.py::TestFlags::test_main_py2_exit PASSED         [  8%]
tests/common/test_flags.py::TestFlags::test_main_py3_runs PASSED         [  9%]
tests/common/test_flags.py::TestFlags::test_main_version PASSED          [  9%]
tests/common/test_flags.py::TestFlags::test_plugin_from_inner_class_by_name PASSED [  9%]
tests/common/test_flags.py::TestFlags::test_plugin_from_inner_class_by_type PASSED [ 10%]
tests/common/test_flags.py::TestFlags::test_unique_plugin_from_args PASSED [ 10%]
tests/common/test_flags.py::TestFlags::test_unique_plugin_from_bytes PASSED [ 11%]
tests/common/test_flags.py::TestFlags::test_unique_plugin_from_class PASSED [ 11%]
tests/common/test_pki.py::TestPki::test_extfile PASSED                   [ 12%]
tests/common/test_pki.py::TestPki::test_extfile_no_ext PASSED            [ 12%]
tests/common/test_pki.py::TestPki::test_gen_csr PASSED                   [ 13%]
tests/common/test_pki.py::TestPki::test_gen_private_key PASSED           [ 13%]
tests/common/test_pki.py::TestPki::test_gen_public_key PASSED            [ 14%]
tests/common/test_pki.py::TestPki::test_get_ext_config PASSED            [ 14%]
tests/common/test_pki.py::TestPki::test_run_openssl_command PASSED       [ 14%]
tests/common/test_pki.py::TestPki::test_sign_csr PASSED                  [ 15%]
tests/common/test_pki.py::TestPki::test_ssl_config PASSED                [ 15%]
tests/common/test_pki.py::TestPki::test_ssl_config_no_ext PASSED         [ 16%]
tests/common/test_text_bytes.py::TestTextBytes::test_bytes PASSED        [ 16%]
tests/common/test_text_bytes.py::TestTextBytes::test_bytes_int PASSED    [ 17%]
tests/common/test_text_bytes.py::TestTextBytes::test_bytes_nochange PASSED [ 17%]
tests/common/test_text_bytes.py::TestTextBytes::test_text PASSED         [ 18%]
tests/common/test_text_bytes.py::TestTextBytes::test_text_int PASSED     [ 18%]
tests/common/test_text_bytes.py::TestTextBytes::test_text_nochange PASSED [ 19%]
tests/common/test_utils.py::TestSocketConnectionUtils::test_context_manager PASSED [ 19%]
tests/common/test_utils.py::TestSocketConnectionUtils::test_decorator PASSED [ 19%]
tests/common/test_utils.py::TestSocketConnectionUtils::test_new_socket_connection_dual PASSED [ 20%]
tests/common/test_utils.py::TestSocketConnectionUtils::test_new_socket_connection_ipv4 PASSED [ 20%]
tests/common/test_utils.py::TestSocketConnectionUtils::test_new_socket_connection_ipv6 PASSED [ 21%]
tests/core/test_acceptor.py::TestAcceptor::test_accepts_client_from_server_socket PASSED [ 21%]
tests/core/test_acceptor.py::TestAcceptor::test_continues_when_no_events PASSED [ 22%]
tests/core/test_acceptor_pool.py::TestAcceptorPool::test_setup_and_shutdown PASSED [ 22%]
tests/core/test_conn_pool.py::TestConnectionPool::test_acquire_and_retain_and_reacquire PASSED [ 23%]
tests/core/test_conn_pool.py::TestConnectionPool::test_closed_connections_are_removed_on_release PASSED [ 23%]
tests/core/test_conn_pool.py::TestConnectionPoolAsync::test_get_events PASSED [ 23%]
tests/core/test_conn_pool.py::TestConnectionPoolAsync::test_handle_events PASSED [ 24%]
tests/core/test_connection.py::TestTcpConnection::testClosesIfNotClosed PASSED [ 24%]
tests/core/test_connection.py::TestTcpConnection::testFlushReturnsIfNoBuffer PASSED [ 25%]
tests/core/test_connection.py::TestTcpConnection::testNoOpIfAlreadyClosed PASSED [ 25%]
tests/core/test_connection.py::TestTcpConnection::testTcpClientRaisesTcpConnectionUninitializedException PASSED [ 26%]
tests/core/test_connection.py::TestTcpConnection::testTcpServerConnectionProperty PASSED [ 26%]
tests/core/test_connection.py::TestTcpConnection::testTcpServerEstablishesIPv4Connection PASSED [ 27%]
tests/core/test_connection.py::TestTcpConnection::testTcpServerEstablishesIPv6Connection PASSED [ 27%]
tests/core/test_connection.py::TestTcpConnection::testTcpServerRaisesTcpConnectionUninitializedException PASSED [ 28%]
tests/core/test_connection.py::TestTcpConnection::testTcpServerWillNotIgnoreDoubleConnectAttemptsSilently PASSED [ 28%]
tests/core/test_connection.py::TestTcpConnection::testThrowsKeyErrorIfNoConn PASSED [ 28%]
tests/core/test_event_dispatcher.py::TestEventDispatcher::test_empties_queue PASSED [ 29%]
tests/core/test_event_dispatcher.py::TestEventDispatcher::test_subscribe PASSED [ 29%]
tests/core/test_event_manager.py::TestEventManager::test_setup_and_teardown PASSED [ 30%]
tests/core/test_event_queue.py::TestCoreEvent::test_publish PASSED       [ 30%]
tests/core/test_event_queue.py::TestCoreEvent::test_subscribe PASSED     [ 31%]
tests/core/test_event_queue.py::TestCoreEvent::test_unsubscribe PASSED   [ 31%]
tests/core/test_event_subscriber.py::TestEventSubscriber::test_event_subscriber PASSED [ 32%]
tests/core/test_listener.py::TestListener::test_setup_and_teardown PASSED [ 32%]
tests/core/test_listener.py::TestListener::test_unix_path_listener PASSED [ 33%]
tests/core/test_listener_pool.py::TestListenerPool::test_multi_listener PASSED [ 33%]
tests/core/test_listener_pool.py::TestListenerPool::test_setup_and_teardown PASSED [ 33%]
tests/core/test_listener_pool.py::TestListenerPool::test_unix_socket_listener PASSED [ 34%]
tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_connection_failed PASSED [ 34%]
tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_authentication_failed PASSED [ 35%]
tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_bails_out_for_unknown_schemes PASSED [ 35%]
tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_bails_out_for_sip_request_lines PASSED [ 36%]
tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_http_get PASSED [ 36%]
tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_http_tunnel PASSED [ 37%]
tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_authenticated_proxy_http_get PASSED [ 37%]
tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_authenticated_proxy_http_tunnel PASSED [ 38%]
tests/http/test_responses.py::TestResponses::test_basic PASSED           [ 38%]
tests/http/test_responses.py::TestResponses::test_chunked_with_compression PASSED [ 38%]
tests/http/test_responses.py::TestResponses::test_chunked_without_compression PASSED [ 39%]
tests/http/test_responses.py::TestResponses::test_close_header PASSED    [ 39%]
tests/http/test_responses.py::TestResponses::test_compression PASSED     [ 40%]
tests/http/test_url.py::TestUrl::test_any_scheme_suffix PASSED           [ 40%]
tests/http/test_url.py::TestUrl::test_assert_raises_for_unknown_schemes PASSED [ 41%]
tests/http/test_url.py::TestUrl::test_full_url PASSED                    [ 41%]
tests/http/test_url.py::TestUrl::test_http_ipv6_url PASSED               [ 42%]
tests/http/test_url.py::TestUrl::test_http_ipv6_with_port_url PASSED     [ 42%]
tests/http/test_url.py::TestUrl::test_http_proxy_url PASSED              [ 42%]
tests/http/test_url.py::TestUrl::test_https_connect_url PASSED           [ 43%]
tests/http/test_url.py::TestUrl::test_https_connect_with_ipv6_malformed_url PASSED [ 43%]
tests/http/test_url.py::TestUrl::test_https_connect_with_ipv6_url PASSED [ 44%]
tests/http/test_url.py::TestUrl::test_just_domain_name_url PASSED        [ 44%]
tests/http/test_url.py::TestUrl::test_no_scheme_suffix PASSED            [ 45%]
tests/http/test_url.py::TestUrl::test_no_trailing_slash_url PASSED       [ 45%]
tests/http/test_url.py::TestUrl::test_trailing_slash_url PASSED          [ 46%]
tests/http/test_url.py::TestUrl::test_unicode_url PASSED                 [ 46%]
tests/http/test_url.py::TestUrl::test_url_str PASSED                     [ 47%]
tests/http/test_url.py::TestUrl::test_username_password PASSED           [ 47%]
tests/http/test_url.py::TestUrl::test_username_password_without_proto_prefix PASSED [ 47%]
tests/http/test_url.py::TestUrl::test_web_server_url PASSED              [ 48%]
tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_fails_without_cred PASSED [ 48%]
tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_fails_with_invalid_cred PASSED [ 49%]
tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_works_with_valid_cred PASSED [ 49%]
tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_works_with_mixed_case_basic_string PASSED [ 50%]
tests/http/exceptions/test_http_request_rejected.py::TestHttpRequestRejected::test_body_response PASSED [ 50%]
tests/http/exceptions/test_http_request_rejected.py::TestHttpRequestRejected::test_empty_response PASSED [ 51%]
tests/http/exceptions/test_http_request_rejected.py::TestHttpRequestRejected::test_status_code_response PASSED [ 51%]
tests/http/parser/test_chunk_parser.py::TestChunkParser::test_chunk_parse_basic PASSED [ 52%]
tests/http/parser/test_chunk_parser.py::TestChunkParser::test_chunk_parse_issue_27 PASSED [ 52%]
tests/http/parser/test_chunk_parser.py::TestChunkParser::test_to_chunks PASSED [ 52%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_build_header PASSED [ 53%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_build_request PASSED [ 53%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_build_response PASSED [ 54%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_build_response_adds_content_length_header PASSED [ 54%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_cannot_parse_sip_protocol PASSED [ 55%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_chunked_request_parse PASSED [ 55%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_chunked_response_parse PASSED [ 56%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_connect_request_with_crlf_as_separate_chunk PASSED [ 56%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_connect_request_without_host_header_request_parse PASSED [ 57%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_find_line PASSED [ 57%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_find_line_returns_None PASSED [ 57%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_get_full_parse PASSED [ 58%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_get_partial_parse1 PASSED [ 58%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_get_partial_parse2 PASSED [ 59%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_has_header PASSED [ 59%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_header_raises PASSED [ 60%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_invalid_ipv6_in_request_line PASSED [ 60%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_is_http_1_1_keep_alive PASSED [ 61%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_is_http_1_1_keep_alive_with_non_close_connection_header PASSED [ 61%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_is_not_http_1_1_keep_alive_for_http_1_0 PASSED [ 61%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_is_not_http_1_1_keep_alive_with_close_header PASSED [ 62%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_is_safe_against_malicious_requests PASSED [ 62%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_issue_127 PASSED [ 63%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_issue_398 PASSED [ 63%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_line_rcvd_to_rcving_headers_state_change PASSED [ 64%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_paramiko_doc PASSED [ 64%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_parses_icap_protocol PASSED [ 65%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_pipelined_chunked_response_parse PASSED [ 65%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_pipelined_response_parse PASSED [ 66%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_post_full_parse PASSED [ 66%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_post_partial_parse PASSED [ 66%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_proxy_protocol PASSED [ 67%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_proxy_protocol_not_for_response_parser PASSED [ 67%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_request_factory PASSED [ 68%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_request_parse_without_content_length PASSED [ 68%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_response_factory PASSED [ 69%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_response_parse PASSED [ 69%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_response_parse_without_content_length PASSED [ 70%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_response_partial_parse PASSED [ 70%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_set_host_port_raises PASSED [ 71%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_unicode_character_domain_connect PASSED [ 71%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_urlparse PASSED [ 71%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_urlparse_on_invalid_connect_request PASSED [ 72%]
tests/http/parser/test_http_parser.py::TestHttpParser::test_valid_ipv6_in_request_line PASSED [ 72%]
tests/http/parser/test_proxy_protocol.py::TestProxyProtocol::test_unknown_value_error PASSED [ 73%]
tests/http/parser/test_proxy_protocol.py::TestProxyProtocol::test_v1 PASSED [ 73%]
tests/http/parser/test_proxy_protocol.py::TestProxyProtocol::test_v1_example_from_spec PASSED [ 74%]
tests/http/parser/test_proxy_protocol.py::TestProxyProtocol::test_v1_unknown_with_no_src_dst PASSED [ 74%]
tests/http/parser/test_proxy_protocol.py::TestProxyProtocol::test_v1_worst_case_ipv4_from_spec PASSED [ 75%]
tests/http/parser/test_proxy_protocol.py::TestProxyProtocol::test_v1_worst_case_ipv6_from_spec PASSED [ 75%]
tests/http/parser/test_proxy_protocol.py::TestProxyProtocol::test_v1_worst_case_unknown_from_spec PASSED [ 76%]
tests/http/parser/test_proxy_protocol.py::TestProxyProtocol::test_v2_not_implemented PASSED [ 76%]
tests/http/parser/test_tls_parser.py::TestTlsParser::test_parse_client_hello PASSED [ 76%]
tests/http/parser/test_tls_parser.py::TestTlsParser::test_parse_server_hello PASSED [ 77%]
tests/http/proxy/test_http2.py::TestHttp2WithProxy::test_http2_via_proxy PASSED [ 77%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_not_initialized_unless_first_request_completes PASSED [ 78%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_on_and_before_upstream_connection PASSED [ 78%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_before_upstream_connection_can_teardown PASSED [ 79%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_plugins_can_teardown_from_write_to_descriptors PASSED [ 79%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_retries_on_ssl_want_write_error PASSED [ 80%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_broken_pipe_error_on_write_will_teardown PASSED [ 80%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_plugins_can_teardown_from_read_from_descriptors PASSED [ 80%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_retries_on_ssl_want_read_error PASSED [ 81%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_timeout_error_on_read_will_teardown PASSED [ 81%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_invokes_handle_pipeline_response PASSED [ 82%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_invokes_on_access_log PASSED [ 82%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_skips_server_teardown_when_client_closes_and_server_never_initialized PASSED [ 83%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_invokes_handle_client_data PASSED [ 83%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_handles_pipeline_response PASSED [ 84%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_invokes_resolve_dns PASSED [ 84%]
tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_require_both_host_port_to_connect PASSED [ 85%]
tests/http/proxy/test_http_proxy_tls_interception.py::TestHttpProxyTlsInterception::test_e2e PASSED [ 85%]
tests/http/web/test_web_server.py::test_on_client_connection_called_on_teardown PASSED [ 85%]
tests/http/web/test_web_server.py::TestWebServerPluginWithPacFilePlugin::test_pac_file_served_from_disk[/tmp/proxy.py/helper/proxy.pac] PASSED [ 86%]
tests/http/web/test_web_server.py::TestWebServerPluginWithPacFilePlugin::test_pac_file_served_from_disk[function FindProxyForURL(url, host) { return "PROXY localhost:8899; DIRECT"; }] PASSED [ 86%]
tests/http/web/test_web_server.py::TestStaticWebServerPlugin::test_static_web_server_serves PASSED [ 87%]
tests/http/web/test_web_server.py::TestStaticWebServerPlugin::test_static_web_server_serves_404 PASSED [ 87%]
tests/http/web/test_web_server.py::TestWebServerPlugin::test_default_web_server_returns_404 PASSED [ 88%]
tests/http/websocket/test_websocket_client.py::TestWebsocketClient::test_handshake_success PASSED [ 88%]
tests/http/websocket/test_websocket_client.py::TestWebsocketClient::test_run PASSED [ 89%]
tests/http/websocket/test_websocket_client.py::TestWebsocketClient::test_send_recv_frames_success PASSED [ 89%]
tests/http/websocket/test_websocket_frame.py::TestWebsocketFrame::test_build_with_mask PASSED [ 90%]
tests/http/websocket/test_websocket_frame.py::TestWebsocketFrame::test_parse_with_mask PASSED [ 90%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_modify_post_data_plugin[test_modify_post_data_plugin] PASSED [ 90%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_proposed_rest_api_plugin[test_proposed_rest_api_plugin] PASSED [ 91%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_redirect_to_custom_server_plugin[test_redirect_to_custom_server_plugin] PASSED [ 91%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_redirect_to_custom_server_plugin_skips_https[test_redirect_to_custom_server_plugin] PASSED [ 92%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_filter_by_upstream_host_plugin[test_filter_by_upstream_host_plugin] PASSED [ 92%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_man_in_the_middle_plugin[test_man_in_the_middle_plugin] PASSED [ 93%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_filter_by_url_regex_plugin[test_filter_by_url_regex_plugin] PASSED [ 93%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin[test_shortlink_plugin] PASSED [ 94%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin_unknown[test_shortlink_plugin] PASSED [ 94%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin_external[test_shortlink_plugin] PASSED [ 95%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_auth_plugin[test_auth_plugin] PASSED [ 95%]
tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_auth_plugin_bypass[test_auth_plugin] PASSED [ 95%]
tests/plugin/test_http_proxy_plugins_with_tls_interception.py::TestHttpProxyPluginExamplesWithTlsInterception::test_modify_post_data_plugin[test_modify_post_data_plugin] PASSED [ 96%]
tests/plugin/test_http_proxy_plugins_with_tls_interception.py::TestHttpProxyPluginExamplesWithTlsInterception::test_man_in_the_middle_plugin[test_man_in_the_middle_plugin] PASSED [ 96%]
tests/socks/test_handler.py::TestHttpProtocolHandlerWithoutServerMock::test PASSED [ 97%]
tests/socks/test_packet.py::TestSocks4Packet::test_pack PASSED           [ 97%]
tests/socks/test_packet.py::TestSocks4Packet::test_parse PASSED          [ 98%]
tests/testing/test_embed.py::TestProxyPyEmbedded::test_proxy_no_vcr PASSED [ 98%]
tests/testing/test_embed.py::TestProxyPyEmbedded::test_proxy_vcr PASSED  [ 99%]
tests/testing/test_embed.py::TestProxyPyEmbedded::test_with_proxy PASSED [ 99%]
tests/testing/test_test_case.py::TestTestCase::test_wait_for_server_raises_timeout_error PASSED [100%]

=================================== FAILURES ===================================
_________________________ TestMain.test_enable_events __________________________

self = <tests.test_main.TestMain testMethod=test_enable_events>
mock_listener_pool = <MagicMock name='ListenerPool' id='94116788654608'>
mock_executor_pool = <MagicMock name='ThreadlessPool' id='94116788751232'>
mock_acceptor_pool = <MagicMock name='AcceptorPool' id='94116788696912'>
mock_event_manager = <MagicMock name='EventManager' id='94116788769744'>
mock_initialize = <MagicMock name='initialize' id='94116788769800'>
mock_sleep = <MagicMock name='sleep' id='94116788823784'>

    @mock.patch('time.sleep')
    @mock.patch('proxy.proxy.FlagParser.initialize')
    @mock.patch('proxy.proxy.EventManager')
    @mock.patch('proxy.proxy.AcceptorPool')
    @mock.patch('proxy.proxy.ThreadlessPool')
    @mock.patch('proxy.proxy.ListenerPool')
    def test_enable_events(
            self,
            mock_listener_pool: mock.Mock,
            mock_executor_pool: mock.Mock,
            mock_acceptor_pool: mock.Mock,
            mock_event_manager: mock.Mock,
            mock_initialize: mock.Mock,
            mock_sleep: mock.Mock,
    ) -> None:
        mock_sleep.side_effect = KeyboardInterrupt()
        mock_initialize.return_value.unix_socket_path = None
        mock_initialize.return_value.local_executor = 0
        mock_initialize.return_value.enable_events = True
        mock_initialize.return_value.port_file = None
        mock_initialize.return_value.enable_ssh_tunnel = False
>       main()

mock_acceptor_pool = <MagicMock name='AcceptorPool' id='94116788696912'>
mock_event_manager = <MagicMock name='EventManager' id='94116788769744'>
mock_executor_pool = <MagicMock name='ThreadlessPool' id='94116788751232'>
mock_initialize = <MagicMock name='initialize' id='94116788769800'>
mock_listener_pool = <MagicMock name='ListenerPool' id='94116788654608'>
mock_sleep = <MagicMock name='sleep' id='94116788823784'>
self       = <tests.test_main.TestMain testMethod=test_enable_events>

tests/test_main.py:213: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
proxy/proxy.py:390: in main
    with Proxy(sys.argv[1:], **opts) as p:
        opts       = {}
proxy/proxy.py:209: in __enter__
    self.setup()
        self       = <proxy.proxy.Proxy object at 0x0000559945c3fde0>
proxy/proxy.py:228: in setup
    self._write_pid_file()
        self       = <proxy.proxy.Proxy object at 0x0000559945c3fde0>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <proxy.proxy.Proxy object at 0x0000559945c3fde0>

    def _write_pid_file(self) -> None:
        if self.flags.pid_file:
>           with open(self.flags.pid_file, 'wb') as pid_file:
E           FileNotFoundError: [Errno 2] No such file or directory: 'MagicMock/initialize().pid_file/94116788823728'

self       = <proxy.proxy.Proxy object at 0x0000559945c3fde0>

proxy/proxy.py:335: FileNotFoundError
_______________________ TestMain.test_main_with_no_flags _______________________

self = <tests.test_main.TestMain testMethod=test_main_with_no_flags>
mock_listener_pool = <MagicMock name='ListenerPool' id='94116799460080'>
mock_executor_pool = <MagicMock name='ThreadlessPool' id='94116799459800'>
mock_acceptor_pool = <MagicMock name='AcceptorPool' id='94116799720656'>
mock_event_manager = <MagicMock name='EventManager' id='94116799594696'>
mock_initialize = <MagicMock name='initialize' id='94116800013328'>
mock_sleep = <MagicMock name='sleep' id='94116800013384'>

    @mock.patch('time.sleep')
    @mock.patch('proxy.proxy.FlagParser.initialize')
    @mock.patch('proxy.proxy.EventManager')
    @mock.patch('proxy.proxy.AcceptorPool')
    @mock.patch('proxy.proxy.ThreadlessPool')
    @mock.patch('proxy.proxy.ListenerPool')
    def test_main_with_no_flags(
            self,
            mock_listener_pool: mock.Mock,
            mock_executor_pool: mock.Mock,
            mock_acceptor_pool: mock.Mock,
            mock_event_manager: mock.Mock,
            mock_initialize: mock.Mock,
            mock_sleep: mock.Mock,
    ) -> None:
        mock_sleep.side_effect = KeyboardInterrupt()
        mock_initialize.return_value.unix_socket_path = None
        mock_initialize.return_value.local_executor = 0
        mock_initialize.return_value.enable_events = False
        mock_initialize.return_value.port_file = None
        mock_initialize.return_value.enable_ssh_tunnel = False
>       main()

mock_acceptor_pool = <MagicMock name='AcceptorPool' id='94116799720656'>
mock_event_manager = <MagicMock name='EventManager' id='94116799594696'>
mock_executor_pool = <MagicMock name='ThreadlessPool' id='94116799459800'>
mock_initialize = <MagicMock name='initialize' id='94116800013328'>
mock_listener_pool = <MagicMock name='ListenerPool' id='94116799460080'>
mock_sleep = <MagicMock name='sleep' id='94116800013384'>
self       = <tests.test_main.TestMain testMethod=test_main_with_no_flags>

tests/test_main.py:169: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
proxy/proxy.py:390: in main
    with Proxy(sys.argv[1:], **opts) as p:
        opts       = {}
proxy/proxy.py:209: in __enter__
    self.setup()
        self       = <proxy.proxy.Proxy object at 0x00005599466ea3d8>
proxy/proxy.py:228: in setup
    self._write_pid_file()
        self       = <proxy.proxy.Proxy object at 0x00005599466ea3d8>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <proxy.proxy.Proxy object at 0x00005599466ea3d8>

    def _write_pid_file(self) -> None:
        if self.flags.pid_file:
>           with open(self.flags.pid_file, 'wb') as pid_file:
E           FileNotFoundError: [Errno 2] No such file or directory: 'MagicMock/initialize().pid_file/94116800336176'

self       = <proxy.proxy.Proxy object at 0x00005599466ea3d8>

proxy/proxy.py:335: FileNotFoundError
-- generated xml file: /tmp/proxy.py/.tox/tmp/test-results/pytest/results.xml --
============================= slowest 10 durations =============================
2.16s call     tests/test_main.py::TestProxyContextManager::test_proxy_context_manager
1.87s call     tests/core/test_event_dispatcher.py::TestEventDispatcher::test_empties_queue
1.74s call     tests/core/test_event_subscriber.py::TestEventSubscriber::test_event_subscriber
1.42s teardown tests/testing/test_embed.py::TestProxyPyEmbedded::test_with_proxy
1.07s teardown tests/http/proxy/test_http2.py::TestHttp2WithProxy::test_http2_via_proxy
0.77s call     tests/core/test_event_dispatcher.py::TestEventDispatcher::test_subscribe
0.65s call     tests/core/test_event_queue.py::TestCoreEvent::test_publish
0.61s call     tests/core/test_event_queue.py::TestCoreEvent::test_unsubscribe
0.61s call     tests/http/proxy/test_http2.py::TestHttp2WithProxy::test_http2_via_proxy
0.60s call     tests/core/test_event_queue.py::TestCoreEvent::test_subscribe
=========================== short test summary info ============================
FAILED tests/test_main.py::TestMain::test_enable_events - FileNotFoundError: ...
FAILED tests/test_main.py::TestMain::test_main_with_no_flags - FileNotFoundEr...
================= 2 failed, 219 passed, 1 deselected in 42.94s =================

To Reproduce

tox -e pypy310

Expected behavior
Tests passing.

Version information

  • OS: Gentoo Linux amd64
  • proxy.py Version: a7077cf
@mgorny mgorny added the Bug Bug report in proxy server label Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug report in proxy server
Projects
None yet
Development

No branches or pull requests

2 participants