← All tasks
pythonencode/httpcore #548Not a task: already works

0.15.0: pytest is failing with latest `pytest-asyncio` and some pytest warnings

envgap__encode__httpcore-548

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
168c8a71b299ba1e4b5a4a556dbcf3c30d953f53
Manifest
requirements.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

encode/httpcore #548 · read the original issue
Yeah looks like pytest is failing

```console

+ PYTHONDONTWRITEBYTECODE=1

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpcore-0.15.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpcore-0.15.0-2.fc35.x86_64/usr/lib/python3.8/site-packages

+ /usr/bin/pytest -ra -p no:randomly

INTERNALERROR> Traceback (most recent call last):

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/_pytest/main.py", line 264, in wrap_session

INTERNALERROR>     config._do_configure()

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/_pytest/config/__init__.py", line 995, in _do_configure

INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_hooks.py", line 277, in call_historic

INTERNALERROR>     res = self._hookexec(self.name, self.get_hookimpls(), kwargs, False)

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec

INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall

INTERNALERROR>     return outcome.get_result()

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result

INTERNALERROR>     raise ex[1].with_traceback(ex[2])

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall

INTERNALERROR>     res = hook_impl.function(*args)

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/pytest_asyncio/plugin.py", line 191, in pytest_configure

INTERNALERROR>     config.issue_config_time_warning(LEGACY_MODE, stacklevel=2)

INTERNALERROR>   File "/usr/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1342, in issue_config_time_warning

INTERNALERROR>     warnings.warn(warning, stacklevel=stacklevel)

INTERNALERROR> DeprecationWarning: The 'asyncio_mode' default value will change to 'strict' in future, please explicitly use 'asyncio_mode=strict' or 'asyncio_mode=auto' in pytest configuration file.

```

Thi can be fixed by patch like below

```patch

--- a/pytest.ini

+++ b/pytest.ini

@@ -0,0 +1,2 @@

+[pytest]

+asyncio_mode = auto

```

Than with that patch:

```console

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpcore-0.15.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpcore-0.15.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/httpcore-0.15.0, configfile: pytest.ini

plugins: httpbin-1.0.2, asyncio-0.18.2, trio-0.7.0, anyio-3.5.0

asyncio: mode=auto

collected 157 items



tests/test_api.py ...                                                                                                                                                [  1%]

tests/test_models.py .............                                                                                                                                   [ 10%]

tests/_async/test_connection.py ............                                                                                                                         [ 17%]

tests/_async/test_connection_pool.py .......................                                                                                                         [ 32%]

tests/_async/test_http11.py ................                                                                                                                         [ 42%]

tests/_async/test_http2.py ................                                                                                                                          [ 52%]

tests/_async/test_http_proxy.py ..........                                                                                                                           [ 59%]

tests/_async/test_integration.py ......                                                                                                                              [ 63%]

tests/_async/test_socks_proxy.py ..........                                                                                                                          [ 69%]

tests/_sync/test_connection.py ......                                                                                                                                [ 73%]

tests/_sync/test_connection_pool.py .............                                                                                                                    [ 81%]

tests/_sync/test_http11.py ........                                                                                                                                  [ 86%]

tests/_sync/test_http2.py ........                                                                                                                                   [ 91%]

tests/_sync/test_http_proxy.py .....                                                                                                                                 [ 94%]

tests/_sync/test_integration.py ...                                                                                                                                  [ 96%]

tests/_sync/test_socks_proxy.py .....                                                                                                                                [100%]



============================================================================= warnings summary =============================================================================

tests/test_models.py::test_response_async_read

  tests/test_models.py:141: PytestWarning: The test <Function test_response_async_read> 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.trio



tests/test_models.py::test_response_async_streaming

  tests/test_models.py:149: PytestWarning: The test <Function test_response_async_streaming> 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.trio



tests/_async/test_connection_pool.py::test_connection_pool_concurrency

  tests/_async/test_connection_pool.py:302: PytestWarning: The test <Function test_connection_pool_concurrency> 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.trio



tests/_async/test_connection_pool.py::test_connection_pool_concurrency_same_domain_closing

  tests/_async/test_connection_pool.py:347: PytestWarning: The test <Function test_connection_pool_concurrency_same_domain_closing> 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.trio



tests/_async/test_connection_pool.py::test_connection_pool_concurrency_same_domain_keepalive

  tests/_async/test_connection_pool.py:389: PytestWarning: The test <Function test_connection_pool_concurrency_same_domain_keepalive> 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.trio



-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

===================================================================== 157 passed, 5 warnings in 10.13s =====================================================================

```

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]