Closed
Description
openedon Feb 14, 2024
Describe the bug
Despite fact that in build env is installed pytest-asyncio
pytest fails in two units complaining about missing suitable plugin for async framework.
Additional context
List of installed modules in build env:
Package Version
------------------ --------
build 1.0.3
charset-normalizer 3.3.2
cppclean 0.13
distro 1.9.0
dnf 4.19.0
exceptiongroup 1.1.3
gpg 1.23.2
idna 3.6
importlib_metadata 7.0.1
iniconfig 2.0.0
installer 0.7.0
libdnf 0.73.0
MarkupSafe 2.1.3
mock 5.1.0
packaging 23.2
pluggy 1.3.0
pyproject_hooks 1.0.0
pytest 8.0.0
pytest-asyncio 0.23.5
pytest_httpserver 1.0.9
python-dateutil 2.8.2
PyYAML 6.0.1
requests 2.31.0
setuptools 69.1.0
six 1.16.0
testpath 0.6.0
toml 0.10.2
tomli 2.0.1
tomli_w 1.0.0
urllib3 1.26.18
Werkzeug 3.0.1
wheel 0.42.0
zipp 3.17.0
Version of responses
0.25.0
Steps to Reproduce
I'm packaging 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.
python3 -sBm build -w --no-isolation
- because I'm calling
build
with--no-isolation
I'm using during all processes only locally installed modules - install .whl file in </install/prefix> using 'installer` module
- run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
- build is performed in env which is
cut off from access to the public network
(pytest is executed with-m "not network"
)
Expected Result
pytest should not fail.
Actual Result
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-responses-0.25.0-4.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-responses-0.25.0-4.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-8.0.0, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/responses-0.25.0
configfile: tox.ini
plugins: asyncio-0.23.5, pytest_httpserver-1.0.9
asyncio: mode=strict
collected 212 items
responses/tests/test_matchers.py .................................. [ 16%]
responses/tests/test_multithreading.py .......... [ 20%]
responses/tests/test_recorder.py .... [ 22%]
responses/tests/test_registries.py ...F..... [ 26%]
responses/tests/test_responses.py ..................................................................................................................................F................ [ 96%]
........ [100%]
========================================================================================= FAILURES ==========================================================================================
____________________________________________________________________________________ test_registry_async ____________________________________________________________________________________
cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.<locals>.<lambda> at 0x7f6587294c10>, when = 'call'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: Optional[
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
] = None,
) -> "CallInfo[TResult]":
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/runner.py:266: in <lambda>
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:493: in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.8/site-packages/_pytest/threadexception.py:87: in pytest_runtest_call
yield from thread_exception_runtest_hook()
/usr/lib/python3.8/site-packages/_pytest/threadexception.py:63: in thread_exception_runtest_hook
yield
/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:65: in unraisable_exception_runtest_hook
yield
/usr/lib/python3.8/site-packages/_pytest/logging.py:839: in pytest_runtest_call
yield from self._runtest_for(item, "call")
/usr/lib/python3.8/site-packages/_pytest/logging.py:822: in _runtest_for
yield
/usr/lib/python3.8/site-packages/_pytest/capture.py:882: in pytest_runtest_call
return (yield)
/usr/lib/python3.8/site-packages/_pytest/skipping.py:257: in pytest_runtest_call
return (yield)
/usr/lib/python3.8/site-packages/_pytest/runner.py:181: in pytest_runtest_call
raise e
/usr/lib/python3.8/site-packages/_pytest/runner.py:173: in pytest_runtest_call
item.runtest()
/usr/lib/python3.8/site-packages/_pytest/python.py:1841: in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:493: in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.8/site-packages/_pytest/python.py:195: in pytest_pyfunc_call
async_warn_and_skip(pyfuncitem.nodeid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nodeid = 'responses/tests/test_registries.py::test_registry_async'
def async_warn_and_skip(nodeid: str) -> None:
msg = "async def functions are not natively supported and have been skipped.\n"
msg += (
"You need to install a suitable plugin for your async framework, for example:\n"
)
msg += " - anyio\n"
msg += " - pytest-asyncio\n"
msg += " - pytest-tornasync\n"
msg += " - pytest-trio\n"
msg += " - pytest-twisted"
> warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))
E pytest.PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
E You need to install a suitable plugin for your async framework, for example:
E - anyio
E - pytest-asyncio
E - pytest-tornasync
E - pytest-trio
E - pytest-twisted
/usr/lib/python3.8/site-packages/_pytest/python.py:187: PytestUnhandledCoroutineWarning
_____________________________________________________________________________________ test_async_calls ______________________________________________________________________________________
cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.<locals>.<lambda> at 0x7f6587ad1040>, when = 'call'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: Optional[
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
] = None,
) -> "CallInfo[TResult]":
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:345:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.8/site-packages/_pytest/runner.py:266: in <lambda>
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:493: in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.8/site-packages/_pytest/threadexception.py:87: in pytest_runtest_call
yield from thread_exception_runtest_hook()
/usr/lib/python3.8/site-packages/_pytest/threadexception.py:63: in thread_exception_runtest_hook
yield
/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_call
yield from unraisable_exception_runtest_hook()
/usr/lib/python3.8/site-packages/_pytest/unraisableexception.py:65: in unraisable_exception_runtest_hook
yield
/usr/lib/python3.8/site-packages/_pytest/logging.py:839: in pytest_runtest_call
yield from self._runtest_for(item, "call")
/usr/lib/python3.8/site-packages/_pytest/logging.py:822: in _runtest_for
yield
/usr/lib/python3.8/site-packages/_pytest/capture.py:882: in pytest_runtest_call
return (yield)
/usr/lib/python3.8/site-packages/_pytest/skipping.py:257: in pytest_runtest_call
return (yield)
/usr/lib/python3.8/site-packages/_pytest/runner.py:181: in pytest_runtest_call
raise e
/usr/lib/python3.8/site-packages/_pytest/runner.py:173: in pytest_runtest_call
item.runtest()
/usr/lib/python3.8/site-packages/_pytest/python.py:1841: in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
/usr/lib/python3.8/site-packages/pluggy/_hooks.py:493: in __call__
return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
/usr/lib/python3.8/site-packages/pluggy/_manager.py:115: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3.8/site-packages/_pytest/python.py:195: in pytest_pyfunc_call
async_warn_and_skip(pyfuncitem.nodeid)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
nodeid = 'responses/tests/test_responses.py::test_async_calls'
def async_warn_and_skip(nodeid: str) -> None:
msg = "async def functions are not natively supported and have been skipped.\n"
msg += (
"You need to install a suitable plugin for your async framework, for example:\n"
)
msg += " - anyio\n"
msg += " - pytest-asyncio\n"
msg += " - pytest-tornasync\n"
msg += " - pytest-trio\n"
msg += " - pytest-twisted"
> warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))
E pytest.PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
E You need to install a suitable plugin for your async framework, for example:
E - anyio
E - pytest-asyncio
E - pytest-tornasync
E - pytest-trio
E - pytest-twisted
/usr/lib/python3.8/site-packages/_pytest/python.py:187: PytestUnhandledCoroutineWarning
===================================================================================== warnings summary ======================================================================================
responses/tests/test_matchers.py: 2 warnings
responses/tests/test_responses.py: 8 warnings
/home/tkloczko/rpmbuild/BUILD/responses-0.25.0/responses/__init__.py:436: DeprecationWarning: Argument 'match_querystring' is deprecated. Use 'responses.matchers.query_param_matcher' or 'responses.matchers.query_string_matcher'
warn(
responses/tests/test_responses.py::test_response_cookies_session[True-True]
responses/tests/test_responses.py::test_response_cookies_session[True-False]
responses/tests/test_responses.py::test_response_cookies_session[True-None]
responses/tests/test_responses.py::test_response_cookies_session[False-True]
responses/tests/test_responses.py::test_response_cookies_session[False-False]
responses/tests/test_responses.py::test_response_cookies_session[False-None]
responses/tests/test_responses.py::test_response_filebody
responses/tests/test_responses.py::test_use_stream_twice_to_double_raw_io
/home/tkloczko/rpmbuild/BUILD/responses-0.25.0/responses/__init__.py:607: DeprecationWarning: stream argument is deprecated. Use stream parameter in request directly
warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
FAILED responses/tests/test_registries.py::test_registry_async - pytest.PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
FAILED responses/tests/test_responses.py::test_async_calls - pytest.PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped.
======================================================================== 2 failed, 210 passed, 18 warnings in 53.76s ========================================================================
Please let me know if you need more details or want me to perform some diagnostics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status
Status
Waiting for: Product Owner