encode / httpx

A next generation HTTP client for Python. 🦋
https://www.python-httpx.org/
BSD 3-Clause "New" or "Revised" License
13.25k stars 839 forks source link

0.23.0: pytest if failing in one unit and some other warnings #2243

Closed kloczek closed 2 years ago

kloczek commented 2 years ago

I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

```console + PYTHONDONTWRITEBYTECODE=1 + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpx-0.23.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpx-0.23.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -p no:randomly --deselect tests/client/test_proxies.py::test_async_proxy_close --deselect tests/client/test_proxies.py::test_socks_proxy --deselect tests/client/test_proxies.py::test_sync_proxy_close --deselect tests/models/test_responses.py::test_response_no_charset_with_iso_8859_1_content --deselect 'tests/test_decoders.py::test_text_decoder[data3-iso-8859-1]' --deselect tests/test_main.py::test_auth --deselect tests/test_main.py::test_download --deselect tests/test_main.py::test_errors --deselect tests/test_main.py::test_follow_redirects --deselect tests/test_main.py::test_get --deselect tests/test_main.py::test_help --deselect tests/test_main.py::test_json --deselect tests/test_main.py::test_post --deselect tests/test_main.py::test_redirects --deselect tests/test_main.py::test_verbose =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/httpx-0.23.0, configfile: pytest.ini plugins: anyio-3.5.0, asyncio-0.18.2, trio-0.7.0 asyncio: mode=auto collected 692 items / 14 deselected / 678 selected tests/test_api.py ........... [ 1%] tests/test_asgi.py .................... [ 4%] tests/test_auth.py ... [ 5%] tests/test_config.py ............................... [ 9%] tests/test_content.py ..................... [ 12%] tests/test_decoders.py .............................. [ 17%] tests/test_exceptions.py .... [ 17%] tests/test_exported_members.py . [ 17%] tests/test_main.py F [ 17%] tests/test_multipart.py ........................... [ 21%] tests/test_status_codes.py ...... [ 22%] tests/test_timeouts.py ........ [ 24%] tests/test_utils.py ................................................... [ 31%] tests/test_wsgi.py ........... [ 33%] tests/client/test_async_client.py .................................................... [ 40%] tests/client/test_auth.py ........................................... [ 47%] tests/client/test_client.py ................................... [ 52%] tests/client/test_cookies.py ....... [ 53%] tests/client/test_event_hooks.py ......... [ 54%] tests/client/test_headers.py ........... [ 56%] tests/client/test_properties.py ....... [ 57%] tests/client/test_proxies.py ....................................................................... [ 67%] tests/client/test_queryparams.py ... [ 68%] tests/client/test_redirects.py ............................... [ 72%] tests/models/test_cookies.py ....... [ 73%] tests/models/test_headers.py .................. [ 76%] tests/models/test_queryparams.py ............. [ 78%] tests/models/test_requests.py ..................... [ 81%] tests/models/test_responses.py ....................................................................................... [ 94%] tests/models/test_url.py ...................................... [100%] ================================================================================= FAILURES ================================================================================= _______________________________________________________________________________ test_binary ________________________________________________________________________________ self = , cli = , args = ['http://127.0.0.1:8000/echo_binary', '-c', 'Hello, world!'] input = None, env = None, catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7f66e82459f0>, None) return_value = None, exception = None, exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_binary(server): url = str(server.url.copy_with(path="/echo_binary")) runner = CliRunner() content = "Hello, world!" > result = runner.invoke(httpx.main, [url, "-c", content]) tests/test_main.py:59: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError ============================================================================= warnings summary ============================================================================= tests/test_timeouts.py:26 /home/tkloczko/rpmbuild/BUILD/httpx-0.23.0/tests/test_timeouts.py:26: PytestUnknownMarkWarning: Unknown pytest.mark.network - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.network tests/client/test_proxies.py:136 /home/tkloczko/rpmbuild/BUILD/httpx-0.23.0/tests/client/test_proxies.py:136: PytestUnknownMarkWarning: Unknown pytest.mark.network - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.network tests/client/test_proxies.py:145 /home/tkloczko/rpmbuild/BUILD/httpx-0.23.0/tests/client/test_proxies.py:145: PytestUnknownMarkWarning: Unknown pytest.mark.network - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.network tests/test_asgi.py::test_asgi_transport[trio] tests/test_asgi.py:73: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_transport_no_body[trio] tests/test_asgi.py:83: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi[trio] tests/test_asgi.py:93: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_urlencoded_path[trio] tests/test_asgi.py:102: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_raw_path[trio] tests/test_asgi.py:112: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_upload[trio] tests/test_asgi.py:122: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_headers[trio] tests/test_asgi.py:131: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_exc[trio] tests/test_asgi.py:148: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_exc_after_response[trio] tests/test_asgi.py:155: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_disconnect_after_response_complete[trio] tests/test_asgi.py:162: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_timeouts.py::test_read_timeout[trio] tests/test_timeouts.py:6: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_timeouts.py::test_write_timeout[trio] tests/test_timeouts.py:15: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_timeouts.py::test_connect_timeout[trio] tests/test_timeouts.py:25: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_timeouts.py::test_pool_timeout[trio] tests/test_timeouts.py:36: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:116: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:172: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:144: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:191: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:210: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:229: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/client/test_async_client.py::test_get[trio] tests/client/test_async_client.py:9: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_get_invalid_url[trio-scheme-not-http(s)] tests/client/test_async_client.py:22: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.parametrize( tests/client/test_async_client.py::test_get_invalid_url[trio-no-scheme] tests/client/test_async_client.py:22: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.parametrize( tests/client/test_async_client.py::test_get_invalid_url[trio-no-host] tests/client/test_async_client.py:22: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.parametrize( tests/client/test_async_client.py::test_build_request[trio] tests/client/test_async_client.py:37: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_post[trio] tests/client/test_async_client.py:52: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_post_json[trio] tests/client/test_async_client.py:60: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_stream_response[trio] tests/client/test_async_client.py:68: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_access_content_stream_response[trio] tests/client/test_async_client.py:79: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_stream_request[trio] tests/client/test_async_client.py:90: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_cannot_stream_sync_request[trio] tests/client/test_async_client.py:101: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_raise_for_status[trio] tests/client/test_async_client.py:112: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_options[trio] tests/client/test_async_client.py:128: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_head[trio] tests/client/test_async_client.py:136: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_put[trio] tests/client/test_async_client.py:144: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_patch[trio] tests/client/test_async_client.py:151: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_delete[trio] tests/client/test_async_client.py:158: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_100_continue[trio] tests/client/test_async_client.py:166: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_context_managed_transport[trio] tests/client/test_async_client.py:180: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_context_managed_transport_and_mount[trio] tests/client/test_async_client.py:212: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_client_closed_state_using_implicit_open[trio] tests/client/test_async_client.py:257: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_client_closed_state_using_with_block[trio] tests/client/test_async_client.py:278: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_mounted_transport[trio] tests/client/test_async_client.py:299: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_async_mock_transport[trio] tests/client/test_async_client.py:314: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_cancellation_during_stream[trio] tests/client/test_async_client.py:327: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_server_extensions[trio] tests/client/test_async_client.py:367: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_event_hooks.py::test_async_event_hooks[trio] tests/client/test_event_hooks.py:66: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_event_hooks.py::test_async_event_hooks_raising_exception[trio] tests/client/test_event_hooks.py:102: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_event_hooks.py::test_async_event_hooks_with_redirect[trio] tests/client/test_event_hooks.py:174: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_redirects.py::test_async_next_request[trio] tests/client/test_redirects.py:152: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_redirects.py::test_async_too_many_redirects[trio] tests/client/test_redirects.py:241: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_redirects.py::test_async_invalid_redirect[trio] tests/client/test_redirects.py:439: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/test_main.py::test_binary - AttributeError: 'function' object has no attribute 'name' ======================================================= 1 failed, 677 passed, 14 deselected, 1033 warnings in 20.76s ======================================================= ```

kloczek commented 2 years ago

Because prev issues I had some units in --deselect. That one unit fail it is definitely new one. Here is updated list of all fails without any units in --deselect list

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpx-0.23.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpx-0.23.0-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -p no:randomly =========================================================================== test session starts ============================================================================ platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/httpx-0.23.0, configfile: pytest.ini plugins: anyio-3.5.0, asyncio-0.18.2, trio-0.7.0 asyncio: mode=auto collected 692 items tests/test_api.py ........... [ 1%] tests/test_asgi.py .................... [ 4%] tests/test_auth.py ... [ 4%] tests/test_config.py ............................... [ 9%] tests/test_content.py ..................... [ 12%] tests/test_decoders.py .............................. [ 16%] tests/test_exceptions.py .... [ 17%] tests/test_exported_members.py . [ 17%] tests/test_main.py FFFFFFFFFFF [ 19%] tests/test_multipart.py ........................... [ 22%] tests/test_status_codes.py ...... [ 23%] tests/test_timeouts.py ........ [ 25%] tests/test_utils.py ................................................... [ 32%] tests/test_wsgi.py ........... [ 33%] tests/client/test_async_client.py .................................................... [ 41%] tests/client/test_auth.py ........................................... [ 47%] tests/client/test_client.py ................................... [ 52%] tests/client/test_cookies.py ....... [ 53%] tests/client/test_event_hooks.py ......... [ 55%] tests/client/test_headers.py ........... [ 56%] tests/client/test_properties.py ....... [ 57%] tests/client/test_proxies.py .....F.........................FF......................................... [ 68%] tests/client/test_queryparams.py ... [ 68%] tests/client/test_redirects.py ............................... [ 73%] tests/models/test_cookies.py ....... [ 74%] tests/models/test_headers.py .................. [ 76%] tests/models/test_queryparams.py ............. [ 78%] tests/models/test_requests.py ..................... [ 81%] tests/models/test_responses.py ........................................................................................ [ 94%] tests/models/test_url.py ...................................... [100%] ================================================================================= FAILURES ================================================================================= ________________________________________________________________________________ test_help _________________________________________________________________________________ self = , cli = , args = ['--help'], input = None, env = None, catch_exceptions = True color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce8bb29a0>, None), return_value = None, exception = None, exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: def test_help(): runner = CliRunner() > result = runner.invoke(httpx.main, ["--help"]) tests/test_main.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError _________________________________________________________________________________ test_get _________________________________________________________________________________ self = , cli = , args = ['http://127.0.0.1:8000/'], input = None, env = None catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce8bb24f0>, None), return_value = None, exception = None exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_get(server): url = str(server.url) runner = CliRunner() > result = runner.invoke(httpx.main, [url]) tests/test_main.py:26: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError ________________________________________________________________________________ test_json _________________________________________________________________________________ self = , cli = , args = ['http://127.0.0.1:8000/json'], input = None, env = None catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce80cd6d0>, None), return_value = None, exception = None exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_json(server): url = str(server.url.copy_with(path="/json")) runner = CliRunner() > result = runner.invoke(httpx.main, [url]) tests/test_main.py:41: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError _______________________________________________________________________________ test_binary ________________________________________________________________________________ self = , cli = , args = ['http://127.0.0.1:8000/echo_binary', '-c', 'Hello, world!'] input = None, env = None, catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce815ed60>, None) return_value = None, exception = None, exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_binary(server): url = str(server.url.copy_with(path="/echo_binary")) runner = CliRunner() content = "Hello, world!" > result = runner.invoke(httpx.main, [url, "-c", content]) tests/test_main.py:59: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError ______________________________________________________________________________ test_redirects ______________________________________________________________________________ self = , cli = , args = ['http://127.0.0.1:8000/redirect_301'], input = None, env = None catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce806d270>, None), return_value = None, exception = None exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_redirects(server): url = str(server.url.copy_with(path="/redirect_301")) runner = CliRunner() > result = runner.invoke(httpx.main, [url]) tests/test_main.py:74: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError __________________________________________________________________________ test_follow_redirects ___________________________________________________________________________ self = , cli = , args = ['http://127.0.0.1:8000/redirect_301', '--follow-redirects'] input = None, env = None, catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efceb71dc70>, None) return_value = None, exception = None, exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_follow_redirects(server): url = str(server.url.copy_with(path="/redirect_301")) runner = CliRunner() > result = runner.invoke(httpx.main, [url, "--follow-redirects"]) tests/test_main.py:88: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError ________________________________________________________________________________ test_post _________________________________________________________________________________ self = , cli = args = ['http://127.0.0.1:8000/echo_body', '-m', 'POST', '-j', '{"hello": "world"}'], input = None, env = None, catch_exceptions = True, color = False, extra = {} exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce806dc20>, None), return_value = None, exception = None, exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_post(server): url = str(server.url.copy_with(path="/echo_body")) runner = CliRunner() > result = runner.invoke(httpx.main, [url, "-m", "POST", "-j", '{"hello": "world"}']) tests/test_main.py:108: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError _______________________________________________________________________________ test_verbose _______________________________________________________________________________ self = , cli = , args = ['http://127.0.0.1:8000/', '-v'], input = None, env = None catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce8b80590>, None), return_value = None, exception = None exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_verbose(server): url = str(server.url) runner = CliRunner() > result = runner.invoke(httpx.main, [url, "-v"]) tests/test_main.py:123: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError ________________________________________________________________________________ test_auth _________________________________________________________________________________ self = , cli = args = ['http://127.0.0.1:8000/', '-v', '--auth', 'username', 'password'], input = None, env = None, catch_exceptions = True, color = False, extra = {}, exc_info = None outstreams = (<_io.BytesIO object at 0x7efce81576d0>, None), return_value = None, exception = None, exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_auth(server): url = str(server.url) runner = CliRunner() > result = runner.invoke(httpx.main, [url, "-v", "--auth", "username", "password"]) tests/test_main.py:147: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError ______________________________________________________________________________ test_download _______________________________________________________________________________ self = , cli = , args = ['http://127.0.0.1:8000/', '--download', 'index.txt'] input = None, env = None, catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce8131a40>, None) return_value = None, exception = None, exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: server = def test_download(server): url = str(server.url) runner = CliRunner() with runner.isolated_filesystem(): > runner.invoke(httpx.main, [url, "--download", "index.txt"]) tests/test_main.py:174: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError _______________________________________________________________________________ test_errors ________________________________________________________________________________ self = , cli = , args = ['invalid://example.org'], input = None, env = None catch_exceptions = True, color = False, extra = {}, exc_info = None, outstreams = (<_io.BytesIO object at 0x7efce815ecc0>, None), return_value = None, exception = None exit_code = 0 def invoke( self, cli: "BaseCommand", args: t.Optional[t.Union[str, t.Sequence[str]]] = None, input: t.Optional[t.Union[str, bytes, t.IO]] = None, env: t.Optional[t.Mapping[str, t.Optional[str]]] = None, catch_exceptions: bool = True, color: bool = False, **extra: t.Any, ) -> Result: """Invokes a command in an isolated environment. The arguments are forwarded directly to the command line script, the `extra` keyword arguments are passed to the :meth:`~clickpkg.Command.main` function of the command. This returns a :class:`Result` object. :param cli: the command to invoke :param args: the arguments to invoke. It may be given as an iterable or a string. When given as string it will be interpreted as a Unix shell command. More details at :func:`shlex.split`. :param input: the input data for `sys.stdin`. :param env: the environment overrides. :param catch_exceptions: Whether to catch any other exceptions than ``SystemExit``. :param extra: the keyword arguments to pass to :meth:`main`. :param color: whether the output should contain color codes. The application can still override this explicitly. .. versionchanged:: 8.0 The result object has the ``return_value`` attribute with the value returned from the invoked command. .. versionchanged:: 4.0 Added the ``color`` parameter. .. versionchanged:: 3.0 Added the ``catch_exceptions`` parameter. .. versionchanged:: 3.0 The result object has the ``exc_info`` attribute with the traceback if available. """ exc_info = None with self.isolation(input=input, env=env, color=color) as outstreams: return_value = None exception: t.Optional[BaseException] = None exit_code = 0 if isinstance(args, str): args = shlex.split(args) try: > prog_name = extra.pop("prog_name") E KeyError: 'prog_name' /usr/lib/python3.8/site-packages/click/testing.py:403: KeyError During handling of the above exception, another exception occurred: def test_errors(): runner = CliRunner() > result = runner.invoke(httpx.main, ["invalid://example.org"]) tests/test_main.py:182: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/click/testing.py:405: in invoke prog_name = self.get_default_prog_name(cli) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , cli = def get_default_prog_name(self, cli: "BaseCommand") -> str: """Given a command object it will return the default program name for it. The default is the `name` attribute or ``"root"`` if not set. """ > return cli.name or "root" E AttributeError: 'function' object has no attribute 'name' /usr/lib/python3.8/site-packages/click/testing.py:195: AttributeError _____________________________________________________________________________ test_socks_proxy _____________________________________________________________________________ def test_socks_proxy(): url = httpx.URL("http://www.example.com") > client = httpx.Client(proxies="socks5://localhost/") tests/client/test_proxies.py:53: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ httpx/_client.py:683: in __init__ self._mounts: typing.Dict[URLPattern, typing.Optional[BaseTransport]] = { httpx/_client.py:686: in else self._init_proxy_transport( httpx/_client.py:740: in _init_proxy_transport return HTTPTransport( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , verify = True, cert = None, http1 = True, http2 = False limits = Limits(max_connections=100, max_keepalive_connections=20, keepalive_expiry=5.0), trust_env = True, proxy = Proxy('socks5://localhost/'), uds = None local_address = None, retries = 0 def __init__( self, verify: VerifyTypes = True, cert: typing.Optional[CertTypes] = None, http1: bool = True, http2: bool = False, limits: Limits = DEFAULT_LIMITS, trust_env: bool = True, proxy: typing.Optional[Proxy] = None, uds: typing.Optional[str] = None, local_address: typing.Optional[str] = None, retries: int = 0, ) -> None: ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env) if proxy is None: self._pool = httpcore.ConnectionPool( ssl_context=ssl_context, max_connections=limits.max_connections, max_keepalive_connections=limits.max_keepalive_connections, keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, uds=uds, local_address=local_address, retries=retries, ) elif proxy.url.scheme in ("http", "https"): self._pool = httpcore.HTTPProxy( proxy_url=httpcore.URL( scheme=proxy.url.raw_scheme, host=proxy.url.raw_host, port=proxy.url.port, target=proxy.url.raw_path, ), proxy_auth=proxy.raw_auth, proxy_headers=proxy.headers.raw, ssl_context=ssl_context, max_connections=limits.max_connections, max_keepalive_connections=limits.max_keepalive_connections, keepalive_expiry=limits.keepalive_expiry, http1=http1, http2=http2, ) elif proxy.url.scheme == "socks5": try: import socksio # noqa except ImportError: # pragma: nocover > raise ImportError( "Using SOCKS proxy, but the 'socksio' package is not installed. " "Make sure to install httpx using `pip install httpx[socks]`." ) from None E ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip install httpx[socks]`. httpx/_transports/default.py:161: ImportError __________________________________________________________________________ test_async_proxy_close __________________________________________________________________________ map = {: , : , : } @contextlib.contextmanager def map_exceptions(map: Dict[Type, Type]) -> Iterator[None]: try: > yield /usr/lib/python3.8/site-packages/httpcore/_exceptions.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , host = 'example.com', port = 80, timeout = 5.0, local_address = None async def connect_tcp( self, host: str, port: int, timeout: typing.Optional[float] = None, local_address: typing.Optional[str] = None, ) -> AsyncNetworkStream: exc_map = { TimeoutError: ConnectTimeout, OSError: ConnectError, anyio.BrokenResourceError: ConnectError, } with map_exceptions(exc_map): with anyio.fail_after(timeout): > stream: anyio.abc.ByteStream = await anyio.connect_tcp( remote_host=host, remote_port=port, local_host=local_address, ) /usr/lib/python3.8/site-packages/httpcore/backends/asyncio.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ remote_host = 'example.com', remote_port = 80 async def connect_tcp( remote_host: IPAddressType, remote_port: int, *, local_host: Optional[IPAddressType] = None, tls: bool = False, ssl_context: Optional[ssl.SSLContext] = None, tls_standard_compatible: bool = True, tls_hostname: Optional[str] = None, happy_eyeballs_delay: float = 0.25 ) -> Union[SocketStream, TLSStream]: """ Connect to a host using the TCP protocol. This function implements the stateless version of the Happy Eyeballs algorithm (RFC 6555). If ``address`` is a host name that resolves to multiple IP addresses, each one is tried until one connection attempt succeeds. If the first attempt does not connected within 250 milliseconds, a second attempt is started using the next address in the list, and so on. On IPv6 enabled systems, an IPv6 address (if available) is tried first. When the connection has been established, a TLS handshake will be done if either ``ssl_context`` or ``tls_hostname`` is not ``None``, or if ``tls`` is ``True``. :param remote_host: the IP address or host name to connect to :param remote_port: port on the target host to connect to :param local_host: the interface address or name to bind the socket to before connecting :param tls: ``True`` to do a TLS handshake with the connected stream and return a :class:`~anyio.streams.tls.TLSStream` instead :param ssl_context: the SSL context object to use (if omitted, a default context is created) :param tls_standard_compatible: If ``True``, performs the TLS shutdown handshake before closing the stream and requires that the server does this as well. Otherwise, :exc:`~ssl.SSLEOFError` may be raised during reads from the stream. Some protocols, such as HTTP, require this option to be ``False``. See :meth:`~ssl.SSLContext.wrap_socket` for details. :param tls_hostname: host name to check the server certificate against (defaults to the value of ``remote_host``) :param happy_eyeballs_delay: delay (in seconds) before starting the next connection attempt :return: a socket stream object if no TLS handshake was done, otherwise a TLS stream :raises OSError: if the connection attempt fails """ # Placed here due to https://github.com/python/mypy/issues/7057 connected_stream: Optional[SocketStream] = None async def try_connect(remote_host: str, event: Event) -> None: nonlocal connected_stream try: stream = await asynclib.connect_tcp(remote_host, remote_port, local_address) except OSError as exc: oserrors.append(exc) return else: if connected_stream is None: connected_stream = stream tg.cancel_scope.cancel() else: await stream.aclose() finally: event.set() asynclib = get_asynclib() local_address: Optional[IPSockAddrType] = None family = socket.AF_UNSPEC if local_host: gai_res = await getaddrinfo(str(local_host), None) family, *_, local_address = gai_res[0] target_host = str(remote_host) try: addr_obj = ip_address(remote_host) except ValueError: # getaddrinfo() will raise an exception if name resolution fails > gai_res = await getaddrinfo(target_host, remote_port, family=family, type=socket.SOCK_STREAM) /usr/lib/python3.8/site-packages/anyio/_core/_sockets.py:152: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ host = 'example.com', port = 80 async def getaddrinfo(host: Union[bytearray, bytes, str], port: Union[str, int, None], *, family: Union[int, AddressFamily] = 0, type: Union[int, SocketKind] = 0, proto: int = 0, flags: int = 0) -> GetAddrInfoReturnType: """ Look up a numeric IP address given a host name. Internationalized domain names are translated according to the (non-transitional) IDNA 2008 standard. .. note:: 4-tuple IPv6 socket addresses are automatically converted to 2-tuples of (host, port), unlike what :func:`socket.getaddrinfo` does. :param host: host name :param port: port number :param family: socket family (`'AF_INET``, ...) :param type: socket type (``SOCK_STREAM``, ...) :param proto: protocol number :param flags: flags to pass to upstream ``getaddrinfo()`` :return: list of tuples containing (family, type, proto, canonname, sockaddr) .. seealso:: :func:`socket.getaddrinfo` """ # Handle unicode hostnames if isinstance(host, str): try: encoded_host = host.encode('ascii') except UnicodeEncodeError: import idna encoded_host = idna.encode(host, uts46=True) else: encoded_host = host > gai_res = await get_asynclib().getaddrinfo(encoded_host, port, family=family, type=type, proto=proto, flags=flags) /usr/lib/python3.8/site-packages/anyio/_core/_sockets.py:419: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ host = b'example.com', port = 80 async def getaddrinfo(host: Union[bytearray, bytes, str], port: Union[str, int, None], *, family: Union[int, AddressFamily] = 0, type: Union[int, SocketKind] = 0, proto: int = 0, flags: int = 0) -> GetAddrInfoReturnType: # https://github.com/python/typeshed/pull/4304 > result = await get_running_loop().getaddrinfo( host, port, family=family, type=type, proto=proto, flags=flags) # type: ignore[arg-type] /usr/lib/python3.8/site-packages/anyio/_backends/_asyncio.py:1570: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_UnixSelectorEventLoop running=False closed=False debug=False>, host = b'example.com', port = 80 async def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0): if self._debug: getaddr_func = self._getaddrinfo_debug else: getaddr_func = socket.getaddrinfo > return await self.run_in_executor( None, getaddr_func, host, port, family, type, proto, flags) /usr/lib64/python3.8/asyncio/base_events.py:825: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = None def run(self): if not self.future.set_running_or_notify_cancel(): return try: > result = self.fn(*self.args, **self.kwargs) /usr/lib64/python3.8/concurrent/futures/thread.py:57: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ host = b'example.com', port = 80, family = , type = , proto = 0, flags = 0 def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0): """Resolve host and port into list of address info entries. Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or None. port is a string service name such as 'http', a numeric port number or None. By passing None as the value of host and port, you can pass NULL to the underlying C API. The family, type and proto arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results. """ # We override this function since we want to translate the numeric family # and socket type values to enum constants. addrlist = [] > for res in _socket.getaddrinfo(host, port, family, type, proto, flags): E socket.gaierror: [Errno -2] Name or service not known /usr/lib64/python3.8/socket.py:918: gaierror During handling of the above exception, another exception occurred: @contextlib.contextmanager def map_httpcore_exceptions() -> typing.Iterator[None]: try: > yield httpx/_transports/default.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = async def handle_async_request( self, request: Request, ) -> Response: assert isinstance(request.stream, AsyncByteStream) req = httpcore.Request( method=request.method, url=httpcore.URL( scheme=request.url.raw_scheme, host=request.url.raw_host, port=request.url.port, target=request.url.raw_path, ), headers=request.headers.raw, content=request.stream, extensions=request.extensions, ) with map_httpcore_exceptions(): > resp = await self._pool.handle_async_request(req) httpx/_transports/default.py:353: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = async def handle_async_request(self, request: Request) -> Response: """ Send an HTTP request, and return an HTTP response. This is the core implementation that is called into by `.request()` or `.stream()`. """ scheme = request.url.scheme.decode() if scheme == "": raise UnsupportedProtocol( "Request URL is missing an 'http://' or 'https://' protocol." ) if scheme not in ("http", "https"): raise UnsupportedProtocol( f"Request URL has an unsupported protocol '{scheme}://'." ) status = RequestStatus(request) async with self._pool_lock: self._requests.append(status) await self._close_expired_connections() await self._attempt_to_acquire_connection(status) while True: timeouts = request.extensions.get("timeout", {}) timeout = timeouts.get("pool", None) try: connection = await status.wait_for_connection(timeout=timeout) except BaseException as exc: # If we timeout here, or if the task is cancelled, then make # sure to remove the request from the queue before bubbling # up the exception. async with self._pool_lock: self._requests.remove(status) raise exc try: response = await connection.handle_async_request(request) except ConnectionNotAvailable: # The ConnectionNotAvailable exception is a special case, that # indicates we need to retry the request on a new connection. # # The most common case where this can occur is when multiple # requests are queued waiting for a single connection, which # might end up as an HTTP/2 connection, but which actually ends # up as HTTP/1.1. async with self._pool_lock: # Maintain our position in the request queue, but reset the # status so that the request becomes queued again. status.unset_connection() await self._attempt_to_acquire_connection(status) except BaseException as exc: await self.response_closed(status) > raise exc /usr/lib/python3.8/site-packages/httpcore/_async/connection_pool.py:253: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = async def handle_async_request(self, request: Request) -> Response: """ Send an HTTP request, and return an HTTP response. This is the core implementation that is called into by `.request()` or `.stream()`. """ scheme = request.url.scheme.decode() if scheme == "": raise UnsupportedProtocol( "Request URL is missing an 'http://' or 'https://' protocol." ) if scheme not in ("http", "https"): raise UnsupportedProtocol( f"Request URL has an unsupported protocol '{scheme}://'." ) status = RequestStatus(request) async with self._pool_lock: self._requests.append(status) await self._close_expired_connections() await self._attempt_to_acquire_connection(status) while True: timeouts = request.extensions.get("timeout", {}) timeout = timeouts.get("pool", None) try: connection = await status.wait_for_connection(timeout=timeout) except BaseException as exc: # If we timeout here, or if the task is cancelled, then make # sure to remove the request from the queue before bubbling # up the exception. async with self._pool_lock: self._requests.remove(status) raise exc try: > response = await connection.handle_async_request(request) /usr/lib/python3.8/site-packages/httpcore/_async/connection_pool.py:237: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = async def handle_async_request(self, request: Request) -> Response: if not self.can_handle_request(request.url.origin): raise RuntimeError( f"Attempted to send request to {request.url.origin} on connection to {self._origin}" ) async with self._request_lock: if self._connection is None: try: stream = await self._connect(request) ssl_object = stream.get_extra_info("ssl_object") http2_negotiated = ( ssl_object is not None and ssl_object.selected_alpn_protocol() == "h2" ) if http2_negotiated or (self._http2 and not self._http1): from .http2 import AsyncHTTP2Connection self._connection = AsyncHTTP2Connection( origin=self._origin, stream=stream, keepalive_expiry=self._keepalive_expiry, ) else: self._connection = AsyncHTTP11Connection( origin=self._origin, stream=stream, keepalive_expiry=self._keepalive_expiry, ) except Exception as exc: self._connect_failed = True > raise exc /usr/lib/python3.8/site-packages/httpcore/_async/connection.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = async def handle_async_request(self, request: Request) -> Response: if not self.can_handle_request(request.url.origin): raise RuntimeError( f"Attempted to send request to {request.url.origin} on connection to {self._origin}" ) async with self._request_lock: if self._connection is None: try: > stream = await self._connect(request) /usr/lib/python3.8/site-packages/httpcore/_async/connection.py:63: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = async def _connect(self, request: Request) -> AsyncNetworkStream: timeouts = request.extensions.get("timeout", {}) timeout = timeouts.get("connect", None) retries_left = self._retries delays = exponential_backoff(factor=RETRIES_BACKOFF_FACTOR) while True: try: if self._uds is None: kwargs = { "host": self._origin.host.decode("ascii"), "port": self._origin.port, "local_address": self._local_address, "timeout": timeout, } async with Trace( "connection.connect_tcp", request, kwargs ) as trace: > stream = await self._network_backend.connect_tcp(**kwargs) /usr/lib/python3.8/site-packages/httpcore/_async/connection.py:111: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , host = 'example.com', port = 80, timeout = 5.0, local_address = None async def connect_tcp( self, host: str, port: int, timeout: Optional[float] = None, local_address: Optional[str] = None, ) -> AsyncNetworkStream: await self._init_backend() > return await self._backend.connect_tcp( host, port, timeout=timeout, local_address=local_address ) /usr/lib/python3.8/site-packages/httpcore/backends/auto.py:29: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , host = 'example.com', port = 80, timeout = 5.0, local_address = None async def connect_tcp( self, host: str, port: int, timeout: typing.Optional[float] = None, local_address: typing.Optional[str] = None, ) -> AsyncNetworkStream: exc_map = { TimeoutError: ConnectTimeout, OSError: ConnectError, anyio.BrokenResourceError: ConnectError, } with map_exceptions(exc_map): with anyio.fail_after(timeout): > stream: anyio.abc.ByteStream = await anyio.connect_tcp( remote_host=host, remote_port=port, local_host=local_address, ) /usr/lib/python3.8/site-packages/httpcore/backends/asyncio.py:109: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , type = , value = gaierror(-2, 'Name or service not known') traceback = def __exit__(self, type, value, traceback): if type is None: try: next(self.gen) except StopIteration: return False else: raise RuntimeError("generator didn't stop") else: if value is None: # Need to force instantiation so we can reliably # tell if we get the same exception back value = type() try: > self.gen.throw(type, value, traceback) /usr/lib64/python3.8/contextlib.py:131: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ map = {: , : , : } @contextlib.contextmanager def map_exceptions(map: Dict[Type, Type]) -> Iterator[None]: try: yield except Exception as exc: # noqa: PIE786 for from_exc, to_exc in map.items(): if isinstance(exc, from_exc): > raise to_exc(exc) E httpcore.ConnectError: [Errno -2] Name or service not known /usr/lib/python3.8/site-packages/httpcore/_exceptions.py:12: ConnectError The above exception was the direct cause of the following exception: @pytest.mark.asyncio @pytest.mark.network async def test_async_proxy_close(): try: client = httpx.AsyncClient(proxies={"https://": PROXY_URL}) > await client.get("http://example.com") tests/client/test_proxies.py:140: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ httpx/_client.py:1751: in get return await self.request( httpx/_client.py:1527: in request return await self.send(request, auth=auth, follow_redirects=follow_redirects) httpx/_client.py:1614: in send response = await self._send_handling_auth( httpx/_client.py:1642: in _send_handling_auth response = await self._send_handling_redirects( httpx/_client.py:1679: in _send_handling_redirects response = await self._send_single_request(request) httpx/_client.py:1716: in _send_single_request response = await transport.handle_async_request(request) httpx/_transports/default.py:353: in handle_async_request resp = await self._pool.handle_async_request(req) /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ @contextlib.contextmanager def map_httpcore_exceptions() -> typing.Iterator[None]: try: yield except Exception as exc: # noqa: PIE-786 mapped_exc = None for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): if not isinstance(exc, from_exc): continue # We want to map to the most specific exception we can find. # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. if mapped_exc is None or issubclass(to_exc, mapped_exc): mapped_exc = to_exc if mapped_exc is None: # pragma: nocover raise message = str(exc) > raise mapped_exc(message) from exc E httpx.ConnectError: [Errno -2] Name or service not known httpx/_transports/default.py:77: ConnectError __________________________________________________________________________ test_sync_proxy_close ___________________________________________________________________________ map = {: , : } @contextlib.contextmanager def map_exceptions(map: Dict[Type, Type]) -> Iterator[None]: try: > yield /usr/lib/python3.8/site-packages/httpcore/_exceptions.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , host = 'example.com', port = 80, timeout = 5.0, local_address = None def connect_tcp( self, host: str, port: int, timeout: typing.Optional[float] = None, local_address: typing.Optional[str] = None, ) -> NetworkStream: address = (host, port) source_address = None if local_address is None else (local_address, 0) exc_map = {socket.timeout: ConnectTimeout, socket.error: ConnectError} with map_exceptions(exc_map): > sock = socket.create_connection( address, timeout, source_address=source_address ) /usr/lib/python3.8/site-packages/httpcore/backends/sync.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('example.com', 80), timeout = 5.0, source_address = None def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, source_address=None): """Connect to *address* and return the socket object. Convenience function. Connect to *address* (a 2-tuple ``(host, port)``) and return the socket object. Passing the optional *timeout* parameter will set the timeout on the socket instance before attempting to connect. If no *timeout* is supplied, the global default timeout setting returned by :func:`getdefaulttimeout` is used. If *source_address* is set it must be a tuple of (host, port) for the socket to bind as a source address before making the connection. A host of '' or port 0 tells the OS to use the default. """ host, port = address err = None > for res in getaddrinfo(host, port, 0, SOCK_STREAM): /usr/lib64/python3.8/socket.py:787: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ host = 'example.com', port = 80, family = 0, type = , proto = 0, flags = 0 def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0): """Resolve host and port into list of address info entries. Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or None. port is a string service name such as 'http', a numeric port number or None. By passing None as the value of host and port, you can pass NULL to the underlying C API. The family, type and proto arguments can be optionally specified in order to narrow the list of addresses returned. Passing zero as a value for each of these arguments selects the full range of results. """ # We override this function since we want to translate the numeric family # and socket type values to enum constants. addrlist = [] > for res in _socket.getaddrinfo(host, port, family, type, proto, flags): E socket.gaierror: [Errno -2] Name or service not known /usr/lib64/python3.8/socket.py:918: gaierror During handling of the above exception, another exception occurred: @contextlib.contextmanager def map_httpcore_exceptions() -> typing.Iterator[None]: try: > yield httpx/_transports/default.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = def handle_request( self, request: Request, ) -> Response: assert isinstance(request.stream, SyncByteStream) req = httpcore.Request( method=request.method, url=httpcore.URL( scheme=request.url.raw_scheme, host=request.url.raw_host, port=request.url.port, target=request.url.raw_path, ), headers=request.headers.raw, content=request.stream, extensions=request.extensions, ) with map_httpcore_exceptions(): > resp = self._pool.handle_request(req) httpx/_transports/default.py:218: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = def handle_request(self, request: Request) -> Response: """ Send an HTTP request, and return an HTTP response. This is the core implementation that is called into by `.request()` or `.stream()`. """ scheme = request.url.scheme.decode() if scheme == "": raise UnsupportedProtocol( "Request URL is missing an 'http://' or 'https://' protocol." ) if scheme not in ("http", "https"): raise UnsupportedProtocol( f"Request URL has an unsupported protocol '{scheme}://'." ) status = RequestStatus(request) with self._pool_lock: self._requests.append(status) self._close_expired_connections() self._attempt_to_acquire_connection(status) while True: timeouts = request.extensions.get("timeout", {}) timeout = timeouts.get("pool", None) try: connection = status.wait_for_connection(timeout=timeout) except BaseException as exc: # If we timeout here, or if the task is cancelled, then make # sure to remove the request from the queue before bubbling # up the exception. with self._pool_lock: self._requests.remove(status) raise exc try: response = connection.handle_request(request) except ConnectionNotAvailable: # The ConnectionNotAvailable exception is a special case, that # indicates we need to retry the request on a new connection. # # The most common case where this can occur is when multiple # requests are queued waiting for a single connection, which # might end up as an HTTP/2 connection, but which actually ends # up as HTTP/1.1. with self._pool_lock: # Maintain our position in the request queue, but reset the # status so that the request becomes queued again. status.unset_connection() self._attempt_to_acquire_connection(status) except BaseException as exc: self.response_closed(status) > raise exc /usr/lib/python3.8/site-packages/httpcore/_sync/connection_pool.py:253: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = def handle_request(self, request: Request) -> Response: """ Send an HTTP request, and return an HTTP response. This is the core implementation that is called into by `.request()` or `.stream()`. """ scheme = request.url.scheme.decode() if scheme == "": raise UnsupportedProtocol( "Request URL is missing an 'http://' or 'https://' protocol." ) if scheme not in ("http", "https"): raise UnsupportedProtocol( f"Request URL has an unsupported protocol '{scheme}://'." ) status = RequestStatus(request) with self._pool_lock: self._requests.append(status) self._close_expired_connections() self._attempt_to_acquire_connection(status) while True: timeouts = request.extensions.get("timeout", {}) timeout = timeouts.get("pool", None) try: connection = status.wait_for_connection(timeout=timeout) except BaseException as exc: # If we timeout here, or if the task is cancelled, then make # sure to remove the request from the queue before bubbling # up the exception. with self._pool_lock: self._requests.remove(status) raise exc try: > response = connection.handle_request(request) /usr/lib/python3.8/site-packages/httpcore/_sync/connection_pool.py:237: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = def handle_request(self, request: Request) -> Response: if not self.can_handle_request(request.url.origin): raise RuntimeError( f"Attempted to send request to {request.url.origin} on connection to {self._origin}" ) with self._request_lock: if self._connection is None: try: stream = self._connect(request) ssl_object = stream.get_extra_info("ssl_object") http2_negotiated = ( ssl_object is not None and ssl_object.selected_alpn_protocol() == "h2" ) if http2_negotiated or (self._http2 and not self._http1): from .http2 import HTTP2Connection self._connection = HTTP2Connection( origin=self._origin, stream=stream, keepalive_expiry=self._keepalive_expiry, ) else: self._connection = HTTP11Connection( origin=self._origin, stream=stream, keepalive_expiry=self._keepalive_expiry, ) except Exception as exc: self._connect_failed = True > raise exc /usr/lib/python3.8/site-packages/httpcore/_sync/connection.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = def handle_request(self, request: Request) -> Response: if not self.can_handle_request(request.url.origin): raise RuntimeError( f"Attempted to send request to {request.url.origin} on connection to {self._origin}" ) with self._request_lock: if self._connection is None: try: > stream = self._connect(request) /usr/lib/python3.8/site-packages/httpcore/_sync/connection.py:63: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , request = def _connect(self, request: Request) -> NetworkStream: timeouts = request.extensions.get("timeout", {}) timeout = timeouts.get("connect", None) retries_left = self._retries delays = exponential_backoff(factor=RETRIES_BACKOFF_FACTOR) while True: try: if self._uds is None: kwargs = { "host": self._origin.host.decode("ascii"), "port": self._origin.port, "local_address": self._local_address, "timeout": timeout, } with Trace( "connection.connect_tcp", request, kwargs ) as trace: > stream = self._network_backend.connect_tcp(**kwargs) /usr/lib/python3.8/site-packages/httpcore/_sync/connection.py:111: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , host = 'example.com', port = 80, timeout = 5.0, local_address = None def connect_tcp( self, host: str, port: int, timeout: typing.Optional[float] = None, local_address: typing.Optional[str] = None, ) -> NetworkStream: address = (host, port) source_address = None if local_address is None else (local_address, 0) exc_map = {socket.timeout: ConnectTimeout, socket.error: ConnectError} with map_exceptions(exc_map): > sock = socket.create_connection( address, timeout, source_address=source_address ) /usr/lib/python3.8/site-packages/httpcore/backends/sync.py:86: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , type = , value = gaierror(-2, 'Name or service not known') traceback = def __exit__(self, type, value, traceback): if type is None: try: next(self.gen) except StopIteration: return False else: raise RuntimeError("generator didn't stop") else: if value is None: # Need to force instantiation so we can reliably # tell if we get the same exception back value = type() try: > self.gen.throw(type, value, traceback) /usr/lib64/python3.8/contextlib.py:131: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ map = {: , : } @contextlib.contextmanager def map_exceptions(map: Dict[Type, Type]) -> Iterator[None]: try: yield except Exception as exc: # noqa: PIE786 for from_exc, to_exc in map.items(): if isinstance(exc, from_exc): > raise to_exc(exc) E httpcore.ConnectError: [Errno -2] Name or service not known /usr/lib/python3.8/site-packages/httpcore/_exceptions.py:12: ConnectError The above exception was the direct cause of the following exception: @pytest.mark.network def test_sync_proxy_close(): try: client = httpx.Client(proxies={"https://": PROXY_URL}) > client.get("http://example.com") tests/client/test_proxies.py:149: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ httpx/_client.py:1039: in get return self.request( httpx/_client.py:815: in request return self.send(request, auth=auth, follow_redirects=follow_redirects) httpx/_client.py:902: in send response = self._send_handling_auth( httpx/_client.py:930: in _send_handling_auth response = self._send_handling_redirects( httpx/_client.py:967: in _send_handling_redirects response = self._send_single_request(request) httpx/_client.py:1003: in _send_single_request response = transport.handle_request(request) httpx/_transports/default.py:218: in handle_request resp = self._pool.handle_request(req) /usr/lib64/python3.8/contextlib.py:131: in __exit__ self.gen.throw(type, value, traceback) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ @contextlib.contextmanager def map_httpcore_exceptions() -> typing.Iterator[None]: try: yield except Exception as exc: # noqa: PIE-786 mapped_exc = None for from_exc, to_exc in HTTPCORE_EXC_MAP.items(): if not isinstance(exc, from_exc): continue # We want to map to the most specific exception we can find. # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to # `httpx.ReadTimeout`, not just `httpx.TimeoutException`. if mapped_exc is None or issubclass(to_exc, mapped_exc): mapped_exc = to_exc if mapped_exc is None: # pragma: nocover raise message = str(exc) > raise mapped_exc(message) from exc E httpx.ConnectError: [Errno -2] Name or service not known httpx/_transports/default.py:77: ConnectError ============================================================================= warnings summary ============================================================================= tests/test_timeouts.py:26 /home/tkloczko/rpmbuild/BUILD/httpx-0.23.0/tests/test_timeouts.py:26: PytestUnknownMarkWarning: Unknown pytest.mark.network - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.network tests/client/test_proxies.py:136 /home/tkloczko/rpmbuild/BUILD/httpx-0.23.0/tests/client/test_proxies.py:136: PytestUnknownMarkWarning: Unknown pytest.mark.network - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.network tests/client/test_proxies.py:145 /home/tkloczko/rpmbuild/BUILD/httpx-0.23.0/tests/client/test_proxies.py:145: PytestUnknownMarkWarning: Unknown pytest.mark.network - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html @pytest.mark.network tests/test_asgi.py::test_asgi_transport[trio] tests/test_asgi.py:73: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_transport_no_body[trio] tests/test_asgi.py:83: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi[trio] tests/test_asgi.py:93: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_urlencoded_path[trio] tests/test_asgi.py:102: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_raw_path[trio] tests/test_asgi.py:112: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_upload[trio] tests/test_asgi.py:122: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_headers[trio] tests/test_asgi.py:131: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_exc[trio] tests/test_asgi.py:148: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_exc_after_response[trio] tests/test_asgi.py:155: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_asgi.py::test_asgi_disconnect_after_response_complete[trio] tests/test_asgi.py:162: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_timeouts.py::test_read_timeout[trio] tests/test_timeouts.py:6: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_timeouts.py::test_write_timeout[trio] tests/test_timeouts.py:15: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_timeouts.py::test_connect_timeout[trio] tests/test_timeouts.py:25: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_timeouts.py::test_pool_timeout[trio] tests/test_timeouts.py:36: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:116: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:172: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:144: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:191: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:210: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/test_utils.py: 1 warning tests/client/test_event_hooks.py: 3 warnings tests/client/test_redirects.py: 112 warnings tests/models/test_url.py: 48 warnings /usr/lib/python3.8/site-packages/rfc3986/_mixin.py:229: DeprecationWarning: Please use rfc3986.validators.Validator instead. This method will be eventually removed. warnings.warn( tests/client/test_async_client.py::test_get[trio] tests/client/test_async_client.py:9: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_get_invalid_url[trio-scheme-not-http(s)] tests/client/test_async_client.py:22: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.parametrize( tests/client/test_async_client.py::test_get_invalid_url[trio-no-scheme] tests/client/test_async_client.py:22: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.parametrize( tests/client/test_async_client.py::test_get_invalid_url[trio-no-host] tests/client/test_async_client.py:22: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.parametrize( tests/client/test_async_client.py::test_build_request[trio] tests/client/test_async_client.py:37: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_post[trio] tests/client/test_async_client.py:52: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_post_json[trio] tests/client/test_async_client.py:60: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_stream_response[trio] tests/client/test_async_client.py:68: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_access_content_stream_response[trio] tests/client/test_async_client.py:79: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_stream_request[trio] tests/client/test_async_client.py:90: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_cannot_stream_sync_request[trio] tests/client/test_async_client.py:101: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_raise_for_status[trio] tests/client/test_async_client.py:112: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_options[trio] tests/client/test_async_client.py:128: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_head[trio] tests/client/test_async_client.py:136: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_put[trio] tests/client/test_async_client.py:144: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_patch[trio] tests/client/test_async_client.py:151: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_delete[trio] tests/client/test_async_client.py:158: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_100_continue[trio] tests/client/test_async_client.py:166: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_context_managed_transport[trio] tests/client/test_async_client.py:180: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_context_managed_transport_and_mount[trio] tests/client/test_async_client.py:212: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_client_closed_state_using_implicit_open[trio] tests/client/test_async_client.py:257: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_client_closed_state_using_with_block[trio] tests/client/test_async_client.py:278: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_mounted_transport[trio] tests/client/test_async_client.py:299: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_async_mock_transport[trio] tests/client/test_async_client.py:314: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_cancellation_during_stream[trio] tests/client/test_async_client.py:327: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_async_client.py::test_server_extensions[trio] tests/client/test_async_client.py:367: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_event_hooks.py::test_async_event_hooks[trio] tests/client/test_event_hooks.py:66: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_event_hooks.py::test_async_event_hooks_raising_exception[trio] tests/client/test_event_hooks.py:102: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_event_hooks.py::test_async_event_hooks_with_redirect[trio] tests/client/test_event_hooks.py:174: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_redirects.py::test_async_next_request[trio] tests/client/test_redirects.py:152: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_redirects.py::test_async_too_many_redirects[trio] tests/client/test_redirects.py:241: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") tests/client/test_redirects.py::test_async_invalid_redirect[trio] tests/client/test_redirects.py:439: PytestWarning: The test is marked with '@pytest.mark.asyncio' but it is not an async function. Please remove asyncio marker. If the test is not marked explicitly, check for global markers applied via 'pytestmark'. @pytest.mark.usefixtures("async_environment") -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ========================================================================= short test summary info ========================================================================== FAILED tests/test_main.py::test_help - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_get - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_json - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_binary - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_redirects - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_follow_redirects - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_post - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_verbose - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_auth - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_download - AttributeError: 'function' object has no attribute 'name' FAILED tests/test_main.py::test_errors - AttributeError: 'function' object has no attribute 'name' FAILED tests/client/test_proxies.py::test_socks_proxy - ImportError: Using SOCKS proxy, but the 'socksio' package is not installed. Make sure to install httpx using `pip... FAILED tests/client/test_proxies.py::test_async_proxy_close - httpx.ConnectError: [Errno -2] Name or service not known FAILED tests/client/test_proxies.py::test_sync_proxy_close - httpx.ConnectError: [Errno -2] Name or service not known ============================================================== 14 failed, 678 passed, 1033 warnings in 22.16s ============================================================== ```
tomchristie commented 2 years ago

Okay - so it's no obvious to me what value this provides. I've never really got the "bundle this python package with the OS" thing. A quick look at the error messages makes it look like the build process you're using there doesn't install the correct set of dependencies / versions.

I couldn't replicate what you're doing here. I started by trying to run this...

$ python3 -sBm build -w --no-isolation
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3: No module named build

If you can completely describe to me exactly what set of commands to use, then we might put some time into tweaking things around to facilitate this kind of packaging.

(Converting to a discussion because I don't consider this a blocking issue, from my perspective.)