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

Tests are broken with pytest-asyncio-0.23* #1427

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

Tests are broken with pytest-asyncio-0.23* #1427

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 against pytest-asyncio == 0.23.7, I'm getting lots of errors:

ERROR tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_fails_without_cred - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_fails_without_cred - ExceptionGroup: errors while tearing down fixture "event_loop" of <Coroutine test_proxy_auth_fails_without_cred> (2 sub-exceptions)
ERROR tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_fails_with_invalid_cred - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket object, fd=-1, family=1, type=1, proto=0>
ERROR tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_fails_with_invalid_cred - TypeError: TestHttpProxyAuthFailed._setUp.<locals>.<lambda>() takes 0 positional arguments but 4 were given
ERROR tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_works_with_valid_cred - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_works_with_valid_cred - TypeError: TestHttpProxyAuthFailed._setUp.<locals>.<lambda>() takes 0 positional arguments but 4 were given
ERROR tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_works_with_mixed_case_basic_string - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/exceptions/test_http_proxy_auth_failed.py::TestHttpProxyAuthFailed::test_proxy_auth_works_with_mixed_case_basic_string - TypeError: TestHttpProxyAuthFailed._setUp.<locals>.<lambda>() takes 0 positional arguments but 4 were given
ERROR tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_on_and_before_upstream_connection - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_on_and_before_upstream_connection - TypeError: TestHttpProxyPlugin._setUp.<locals>.<lambda>() takes 0 positional arguments but 4 were given
ERROR tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_before_upstream_connection_can_teardown - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/proxy/test_http_proxy.py::TestHttpProxyPlugin::test_proxy_plugin_before_upstream_connection_can_teardown - TypeError: TestHttpProxyPlugin._setUp.<locals>.<lambda>() takes 0 positional arguments but 4 were given
ERROR tests/http/proxy/test_http_proxy_tls_interception.py::TestHttpProxyTlsInterception::test_e2e - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_connection_failed - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_connection_failed - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_authentication_failed - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_authentication_failed - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_bails_out_for_unknown_schemes - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_bails_out_for_unknown_schemes - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_bails_out_for_sip_request_lines - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandlerWithoutServerMock::test_proxy_bails_out_for_sip_request_lines - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_http_get - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_http_get - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_http_tunnel - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_http_tunnel - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_authenticated_proxy_http_get - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_authenticated_proxy_http_get - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_authenticated_proxy_http_tunnel - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/test_protocol_handler.py::TestHttpProtocolHandler::test_authenticated_proxy_http_tunnel - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/web/test_web_server.py::TestWebServerPluginWithPacFilePlugin::test_pac_file_served_from_disk[/tmp/proxy.py/helper/proxy.pac] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/web/test_web_server.py::TestWebServerPluginWithPacFilePlugin::test_pac_file_served_from_disk[/tmp/proxy.py/helper/proxy.pac] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/web/test_web_server.py::TestWebServerPluginWithPacFilePlugin::test_pac_file_served_from_disk[function FindProxyForURL(url, host) { return "PROXY localhost:8899; DIRECT"; }] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/web/test_web_server.py::TestWebServerPluginWithPacFilePlugin::test_pac_file_served_from_disk[function FindProxyForURL(url, host) { return "PROXY localhost:8899; DIRECT"; }] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/web/test_web_server.py::TestStaticWebServerPlugin::test_static_web_server_serves - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/web/test_web_server.py::TestStaticWebServerPlugin::test_static_web_server_serves - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/web/test_web_server.py::TestStaticWebServerPlugin::test_static_web_server_serves_404 - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/web/test_web_server.py::TestStaticWebServerPlugin::test_static_web_server_serves_404 - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/http/web/test_web_server.py::TestWebServerPlugin::test_default_web_server_returns_404 - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/http/web/test_web_server.py::TestWebServerPlugin::test_default_web_server_returns_404 - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_modify_post_data_plugin[test_modify_post_data_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_modify_post_data_plugin[test_modify_post_data_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_proposed_rest_api_plugin[test_proposed_rest_api_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_proposed_rest_api_plugin[test_proposed_rest_api_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_redirect_to_custom_server_plugin[test_redirect_to_custom_server_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_redirect_to_custom_server_plugin[test_redirect_to_custom_server_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_redirect_to_custom_server_plugin_skips_https[test_redirect_to_custom_server_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_redirect_to_custom_server_plugin_skips_https[test_redirect_to_custom_server_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_filter_by_upstream_host_plugin[test_filter_by_upstream_host_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_filter_by_upstream_host_plugin[test_filter_by_upstream_host_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_man_in_the_middle_plugin[test_man_in_the_middle_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_man_in_the_middle_plugin[test_man_in_the_middle_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_filter_by_url_regex_plugin[test_filter_by_url_regex_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_filter_by_url_regex_plugin[test_filter_by_url_regex_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin[test_shortlink_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin[test_shortlink_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin_unknown[test_shortlink_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin_unknown[test_shortlink_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin_external[test_shortlink_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_shortlink_plugin_external[test_shortlink_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_auth_plugin[test_auth_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_auth_plugin[test_auth_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_auth_plugin_bypass[test_auth_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins.py::TestHttpProxyPluginExamples::test_auth_plugin_bypass[test_auth_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins_with_tls_interception.py::TestHttpProxyPluginExamplesWithTlsInterception::test_modify_post_data_plugin[test_modify_post_data_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins_with_tls_interception.py::TestHttpProxyPluginExamplesWithTlsInterception::test_modify_post_data_plugin[test_modify_post_data_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
ERROR tests/plugin/test_http_proxy_plugins_with_tls_interception.py::TestHttpProxyPluginExamplesWithTlsInterception::test_man_in_the_middle_plugin[test_man_in_the_middle_plugin] - pluggy.PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
ERROR tests/plugin/test_http_proxy_plugins_with_tls_interception.py::TestHttpProxyPluginExamplesWithTlsInterception::test_man_in_the_middle_plugin[test_man_in_the_middle_plugin] - ValueError: not enough values to unpack (expected 2, got 0)
FAILED tests/http/proxy/test_http_proxy_tls_interception.py::TestHttpProxyTlsInterception::test_e2e - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket object, fd=-1, family=1, type=1, proto=0>
FAILED tests/test_main.py::TestMain::test_enable_events - pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=1, type=1, proto=0>

Test log (760 KiB): test.txt

To Reproduce

tox -e py311
. .tox/py311/bin/activate
pip install -U pytest-asyncio
pytest --ignore tests/integration # (because of #1426)

Expected behavior
Tests passing.

Version information

  • OS: Gentoo Linux amd64
  • proxy.py Version: a7077cf

Additional context
Some tracebacks (from the log):

Exception ignore
d in: <function BaseEventLoop.__del__ at 0x7fa65ac505e0>
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/base_events.py", line 695, in __del__
    self.close()
  File "/usr/lib/python3.11/asyncio/unix_events.py", line 68, in close
    super().close()
  File "/usr/lib/python3.11/asyncio/selector_events.py", line 91, in close
    self._close_self_pipe()
  File "/usr/lib/python3.11/asyncio/selector_events.py", line 98, in _close_self_pipe
    self._remove_reader(self._ssock.fileno())
                        ^^^^^^^^^^^
AttributeError: '_UnixSelectorEventLoop' object has no attribute '_ssock'
self = <_UnixSelectorEventLoop running=False closed=False debug=False>, fd = 125
callback = <bound method BaseSelectorEventLoop._read_from_self of <_UnixSelectorEventLoop running=False closed=False debug=False>>
args = (), handle = <Handle BaseSelectorEventLoop._read_from_self()>
key = <MagicMock name='DefaultSelector().get_key()' id='140352427893520'>
mask = <MagicMock name='DefaultSelector().get_key().events' id='140352423194960'>

    def _add_reader(self, fd, callback, *args):
        self._check_closed()
        handle = events.Handle(callback, args, self, None)
        try:
            key = self._selector.get_key(fd)
        except KeyError:
            self._selector.register(fd, selectors.EVENT_READ,
                                    (handle, None))
        else:
>           mask, (reader, writer) = key.events, key.data
E           ValueError: not enough values to unpack (expected 2, got 0)

args       = ()
callback   = <bound method BaseSelectorEventLoop._read_from_self of <_UnixSelectorEventLoop running=False closed=False debug=False>>
fd         = 125
handle     = <Handle BaseSelectorEventLoop._read_from_self()>
key        = <MagicMock name='DefaultSelector().get_key()' id='140352427893520'>
mask       = <MagicMock name='DefaultSelector().get_key().events' id='140352423194960'>
self       = <_UnixSelectorEventLoop running=False closed=False debug=False>

/usr/lib/python3.11/asyncio/selector_events.py:274: ValueError

Screenshots
If applicable, add screenshots to help explain your problem.

@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