Support rpm build/test style. #2270
-
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: + 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 = <click.testing.CliRunner object at 0x7f66e8252e80>, cli = <function main at 0x7f66e9c4c280>, 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 = <tests.conftest.TestServer object at 0x7f66e8fd4fa0>
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 = <click.testing.CliRunner object at 0x7f66e8252e80>, cli = <function main at 0x7f66e9c4c280>
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 <Function test_asgi_transport[trio]> 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 <Function test_asgi_transport_no_body[trio]> 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 <Function test_asgi[trio]> 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 <Function test_asgi_urlencoded_path[trio]> 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 <Function test_asgi_raw_path[trio]> 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 <Function test_asgi_upload[trio]> 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 <Function test_asgi_headers[trio]> 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 <Function test_asgi_exc[trio]> 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 <Function test_asgi_exc_after_response[trio]> 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 <Function test_asgi_disconnect_after_response_complete[trio]> 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 <Function test_read_timeout[trio]> 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 <Function test_write_timeout[trio]> 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 <Function test_connect_timeout[trio]> 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 <Function test_pool_timeout[trio]> 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 <Function test_get[trio]> 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 <Function test_get_invalid_url[trio-scheme-not-http(s)]> 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 <Function test_get_invalid_url[trio-no-scheme]> 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 <Function test_get_invalid_url[trio-no-host]> 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 <Function test_build_request[trio]> 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 <Function test_post[trio]> 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 <Function test_post_json[trio]> 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 <Function test_stream_response[trio]> 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 <Function test_access_content_stream_response[trio]> 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 <Function test_stream_request[trio]> 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 <Function test_cannot_stream_sync_request[trio]> 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 <Function test_raise_for_status[trio]> 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 <Function test_options[trio]> 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 <Function test_head[trio]> 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 <Function test_put[trio]> 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 <Function test_patch[trio]> 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 <Function test_delete[trio]> 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 <Function test_100_continue[trio]> 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 <Function test_context_managed_transport[trio]> 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 <Function test_context_managed_transport_and_mount[trio]> 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 <Function test_client_closed_state_using_implicit_open[trio]> 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 <Function test_client_closed_state_using_with_block[trio]> 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 <Function test_mounted_transport[trio]> 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 <Function test_async_mock_transport[trio]> 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 <Function test_cancellation_during_stream[trio]> 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 <Function test_server_extensions[trio]> 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 <Function test_async_event_hooks[trio]> 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 <Function test_async_event_hooks_raising_exception[trio]> 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 <Function test_async_event_hooks_with_redirect[trio]> 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 <Function test_async_next_request[trio]> 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 <Function test_async_too_many_redirects[trio]> 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 <Function test_async_invalid_redirect[trio]> 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 =======================================================
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 7 replies
-
Because prev issues I had some units in --deselect. + 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 = <click.testing.CliRunner object at 0x7efce8bbd760>, cli = <function main at 0x7efce9bc41f0>, 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 = <click.testing.CliRunner object at 0x7efce8bbd760>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce8bbdf40>, cli = <function main at 0x7efce9bc41f0>, 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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce8bbdf40>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce8bbc6a0>, cli = <function main at 0x7efce9bc41f0>, 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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce8bbc6a0>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce814a6a0>, cli = <function main at 0x7efce9bc41f0>, 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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce814a6a0>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce80cf400>, cli = <function main at 0x7efce9bc41f0>, 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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce80cf400>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce80f0ee0>, cli = <function main at 0x7efce9bc41f0>, 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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce80f0ee0>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce8154b80>, cli = <function main at 0x7efce9bc41f0>
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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce8154b80>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce8ad2760>, cli = <function main at 0x7efce9bc41f0>, 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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce8ad2760>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce8b6dca0>, cli = <function main at 0x7efce9bc41f0>
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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce8b6dca0>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce80d7d90>, cli = <function main at 0x7efce9bc41f0>, 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 = <tests.conftest.TestServer object at 0x7efce8ebd700>
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 = <click.testing.CliRunner object at 0x7efce80d7d90>, cli = <function main at 0x7efce9bc41f0>
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 = <click.testing.CliRunner object at 0x7efce808ddf0>, cli = <function main at 0x7efce9bc41f0>, 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 = <click.testing.CliRunner object at 0x7efce808ddf0>, cli = <function main at 0x7efce9bc41f0>
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 <dictcomp>
else self._init_proxy_transport(
httpx/_client.py:740: in _init_proxy_transport
return HTTPTransport(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httpx.HTTPTransport object at 0x7efce355cc40>, 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 = {<class 'TimeoutError'>: <class 'httpcore.ConnectTimeout'>, <class 'OSError'>: <class 'httpcore.ConnectError'>, <class 'anyio.BrokenResourceError'>: <class 'httpcore.ConnectError'>}
@contextlib.contextmanager
def map_exceptions(map: Dict[Type, Type]) -> Iterator[None]:
try:
> yield
/usr/lib/python3.8/site-packages/httpcore/_exceptions.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httpcore.backends.asyncio.AsyncIOBackend object at 0x7efce3577790>, 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 = <AddressFamily.AF_UNSPEC: 0>, type = <SocketKind.SOCK_STREAM: 1>, 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 = <httpx.AsyncHTTPTransport object at 0x7efce355c760>, request = <Request('GET', 'http://example.com')>
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 = <httpcore.AsyncConnectionPool object at 0x7efce359b160>, request = <Request [b'GET']>
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 = <httpcore.AsyncConnectionPool object at 0x7efce359b160>, request = <Request [b'GET']>
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 = <AsyncHTTPConnection [CONNECTION FAILED]>, request = <Request [b'GET']>
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 = <AsyncHTTPConnection [CONNECTION FAILED]>, request = <Request [b'GET']>
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 = <AsyncHTTPConnection [CONNECTION FAILED]>, request = <Request [b'GET']>
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 = <httpcore.backends.auto.AutoBackend object at 0x7efce355c3a0>, 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 = <httpcore.backends.asyncio.AsyncIOBackend object at 0x7efce3577790>, 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 = <contextlib._GeneratorContextManager object at 0x7efce3577250>, type = <class 'socket.gaierror'>, value = gaierror(-2, 'Name or service not known')
traceback = <traceback object at 0x7efce36a2d40>
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 = {<class 'TimeoutError'>: <class 'httpcore.ConnectTimeout'>, <class 'OSError'>: <class 'httpcore.ConnectError'>, <class 'anyio.BrokenResourceError'>: <class 'httpcore.ConnectError'>}
@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 = {<class 'socket.timeout'>: <class 'httpcore.ConnectTimeout'>, <class 'OSError'>: <class 'httpcore.ConnectError'>}
@contextlib.contextmanager
def map_exceptions(map: Dict[Type, Type]) -> Iterator[None]:
try:
> yield
/usr/lib/python3.8/site-packages/httpcore/_exceptions.py:8:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <httpcore.backends.sync.SyncBackend object at 0x7efce26700a0>, 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 = <SocketKind.SOCK_STREAM: 1>, 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 = <httpx.HTTPTransport object at 0x7efce2670040>, request = <Request('GET', 'http://example.com')>
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 = <httpcore.ConnectionPool object at 0x7efce2670100>, request = <Request [b'GET']>
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 = <httpcore.ConnectionPool object at 0x7efce2670100>, request = <Request [b'GET']>
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 = <HTTPConnection [CONNECTION FAILED]>, request = <Request [b'GET']>
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 = <HTTPConnection [CONNECTION FAILED]>, request = <Request [b'GET']>
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 = <HTTPConnection [CONNECTION FAILED]>, request = <Request [b'GET']>
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 = <httpcore.backends.sync.SyncBackend object at 0x7efce26700a0>, 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 = <contextlib._GeneratorContextManager object at 0x7efce2ad8640>, type = <class 'socket.gaierror'>, value = gaierror(-2, 'Name or service not known')
traceback = <traceback object at 0x7efce28477c0>
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 = {<class 'socket.timeout'>: <class 'httpcore.ConnectTimeout'>, <class 'OSError'>: <class 'httpcore.ConnectError'>}
@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 <Function test_asgi_transport[trio]> 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 <Function test_asgi_transport_no_body[trio]> 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 <Function test_asgi[trio]> 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 <Function test_asgi_urlencoded_path[trio]> 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 <Function test_asgi_raw_path[trio]> 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 <Function test_asgi_upload[trio]> 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 <Function test_asgi_headers[trio]> 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 <Function test_asgi_exc[trio]> 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 <Function test_asgi_exc_after_response[trio]> 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 <Function test_asgi_disconnect_after_response_complete[trio]> 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 <Function test_read_timeout[trio]> 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 <Function test_write_timeout[trio]> 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 <Function test_connect_timeout[trio]> 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 <Function test_pool_timeout[trio]> 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 <Function test_get[trio]> 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 <Function test_get_invalid_url[trio-scheme-not-http(s)]> 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 <Function test_get_invalid_url[trio-no-scheme]> 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 <Function test_get_invalid_url[trio-no-host]> 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 <Function test_build_request[trio]> 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 <Function test_post[trio]> 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 <Function test_post_json[trio]> 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 <Function test_stream_response[trio]> 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 <Function test_access_content_stream_response[trio]> 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 <Function test_stream_request[trio]> 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 <Function test_cannot_stream_sync_request[trio]> 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 <Function test_raise_for_status[trio]> 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 <Function test_options[trio]> 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 <Function test_head[trio]> 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 <Function test_put[trio]> 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 <Function test_patch[trio]> 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 <Function test_delete[trio]> 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 <Function test_100_continue[trio]> 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 <Function test_context_managed_transport[trio]> 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 <Function test_context_managed_transport_and_mount[trio]> 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 <Function test_client_closed_state_using_implicit_open[trio]> 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 <Function test_client_closed_state_using_with_block[trio]> 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 <Function test_mounted_transport[trio]> 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 <Function test_async_mock_transport[trio]> 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 <Function test_cancellation_during_stream[trio]> 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 <Function test_server_extensions[trio]> 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 <Function test_async_event_hooks[trio]> 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 <Function test_async_event_hooks_raising_exception[trio]> 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 <Function test_async_event_hooks_with_redirect[trio]> 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 <Function test_async_next_request[trio]> 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 <Function test_async_too_many_redirects[trio]> 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 <Function test_async_invalid_redirect[trio]> 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 ============================================================== |
Beta Was this translation helpful? Give feedback.
-
Okay - so it's not 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.) |
Beta Was this translation helpful? Give feedback.
-
Any progress on pytest fails? + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpx-0.25.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpx-0.25.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network' -p no:randomly
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/httpx-0.25.0
configfile: pyproject.toml
plugins: anyio-3.7.1
collected 830 items / 5 deselected / 825 selected
tests/test_api.py ........... [ 1%]
tests/test_asgi.py ...................... [ 4%]
tests/test_auth.py .... [ 4%]
tests/test_config.py ............................... [ 8%]
tests/test_content.py ........................................ [ 13%]
tests/test_decoders.py .................................. [ 17%]
tests/test_exceptions.py ... [ 17%]
tests/test_exported_members.py . [ 17%]
tests/test_main.py FFFFFFFFFFF [ 19%]
tests/test_multipart.py ...................................... [ 23%]
tests/test_status_codes.py ...... [ 24%]
tests/test_timeouts.py ...... [ 25%]
tests/test_urlparse.py ................................... [ 29%]
tests/test_utils.py .................................................... [ 35%]
.. [ 35%]
tests/test_wsgi.py ............ [ 37%]
tests/client/test_async_client.py ...................................... [ 41%]
.............. [ 43%]
tests/client/test_auth.py ............s................................. [ 49%]
................................... [ 53%]
tests/client/test_client.py ................................... [ 57%]
tests/client/test_cookies.py ....... [ 58%]
tests/client/test_event_hooks.py ......... [ 59%]
tests/client/test_headers.py ........... [ 60%]
tests/client/test_properties.py ........ [ 61%]
tests/client/test_proxies.py ........................................... [ 67%]
............................. [ 70%]
tests/client/test_queryparams.py ... [ 71%]
tests/client/test_redirects.py ............................... [ 74%]
tests/models/test_cookies.py ....... [ 75%]
tests/models/test_headers.py .................. [ 77%]
tests/models/test_queryparams.py .............. [ 79%]
tests/models/test_requests.py ....................... [ 82%]
tests/models/test_responses.py ......................................... [ 87%]
................................................................ [ 95%]
tests/models/test_url.py ......................................... [100%]
=================================== FAILURES ===================================
__________________________________ test_help ___________________________________
self = <click.testing.CliRunner object at 0x7fba3f92cd30>
cli = <function main at 0x7fba407498b0>, args = ['--help'], input = None
env = None, catch_exceptions = True, color = False, extra = {}, exc_info = None
outstreams = (<_io.BytesIO object at 0x7fba3ffaa090>, 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[t.Any]]] = 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:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3f92cd30>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3fab6280>
cli = <function main at 0x7fba407498b0>, 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 0x7fba3dfbe3b0>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
def test_get(server):
url = str(server.url)
runner = CliRunner()
> result = runner.invoke(httpx.main, [url])
tests/test_main.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3fab6280>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3f8b4820>
cli = <function main at 0x7fba407498b0>, 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 0x7fba3ffaa7c0>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
def test_json(server):
url = str(server.url.copy_with(path="/json"))
runner = CliRunner()
> result = runner.invoke(httpx.main, [url])
tests/test_main.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3f8b4820>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3f9146a0>
cli = <function main at 0x7fba407498b0>
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 0x7fba40180f40>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
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:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3f9146a0>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3f9ac4f0>
cli = <function main at 0x7fba407498b0>
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 0x7fba3fc93b80>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
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:75:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3f9ac4f0>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3fc8c400>
cli = <function main at 0x7fba407498b0>
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 0x7fba3fb18900>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
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:89:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3fc8c400>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3f847d90>
cli = <function main at 0x7fba407498b0>
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 0x7fba3dfe2950>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
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:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3f847d90>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3dfc05e0>
cli = <function main at 0x7fba407498b0>, 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 0x7fba3f994a40>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
def test_verbose(server):
url = str(server.url)
runner = CliRunner()
> result = runner.invoke(httpx.main, [url, "-v"])
tests/test_main.py:124:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3dfc05e0>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3dfde1f0>
cli = <function main at 0x7fba407498b0>
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 0x7fba3f91e8b0>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
def test_auth(server):
url = str(server.url)
runner = CliRunner()
> result = runner.invoke(httpx.main, [url, "-v", "--auth", "username", "password"])
tests/test_main.py:148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3dfde1f0>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3dfc0eb0>
cli = <function main at 0x7fba407498b0>
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 0x7fba3fa9aef0>, 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[t.Any]]] = 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 = <tests.conftest.TestServer object at 0x7fba3fcf5820>
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:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3dfc0eb0>
cli = <function main at 0x7fba407498b0>
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 = <click.testing.CliRunner object at 0x7fba3fa3bc40>
cli = <function main at 0x7fba407498b0>, args = ['invalid://example.org']
input = None, env = None, catch_exceptions = True, color = False, extra = {}
exc_info = None, outstreams = (<_io.BytesIO object at 0x7fba3fa9abd0>, 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[t.Any]]] = 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:183:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/click/testing.py:405: in invoke
prog_name = self.get_default_prog_name(cli)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <click.testing.CliRunner object at 0x7fba3fa3bc40>
cli = <function main at 0x7fba407498b0>
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
=========================== short test summary info ============================
SKIPPED [1] tests/client/test_auth.py:272: netrc files without a password are invalid with Python < 3.11
FAILED tests/test_main.py::test_help - AttributeError: 'function' object has ...
FAILED tests/test_main.py::test_get - AttributeError: 'function' object has n...
FAILED tests/test_main.py::test_json - AttributeError: 'function' object has ...
FAILED tests/test_main.py::test_binary - AttributeError: 'function' object ha...
FAILED tests/test_main.py::test_redirects - AttributeError: 'function' object...
FAILED tests/test_main.py::test_follow_redirects - AttributeError: 'function'...
FAILED tests/test_main.py::test_post - AttributeError: 'function' object has ...
FAILED tests/test_main.py::test_verbose - AttributeError: 'function' object h...
FAILED tests/test_main.py::test_auth - AttributeError: 'function' object has ...
FAILED tests/test_main.py::test_download - AttributeError: 'function' object ...
FAILED tests/test_main.py::test_errors - AttributeError: 'function' object ha...
=========== 11 failed, 813 passed, 1 skipped, 5 deselected in 12.57s =========== |
Beta Was this translation helpful? Give feedback.
-
Any progress? 🤔 |
Beta Was this translation helpful? Give feedback.
-
Just FTR: 0.25.2 still fails in the same units. |
Beta Was this translation helpful? Give feedback.
Okay - so it's not 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...
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…