Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test suite with pytest 7 due to deprecation warnings #6663

Closed
1 task done
bnavigator opened this issue Mar 28, 2022 · 5 comments
Closed
1 task done

Failing test suite with pytest 7 due to deprecation warnings #6663

bnavigator opened this issue Mar 28, 2022 · 5 comments
Labels

Comments

@bnavigator
Copy link
Contributor

bnavigator commented Mar 28, 2022

Describe the bug

Pytest 7 deprecates the usage of pytest.warns(None). See pytest-dev/pytest#9404 for a discussion about it.

The test suite erroring out on any warning fails with pytest 7.1.1

To Reproduce

  1. Install a recent pytest (7.1.1)
  2. Run pytest on the aiohttp source

Expected behavior

Clean pass

Logs/tracebacks

[  106s] =================================== FAILURES ===================================
[  106s] ___________________________ test_async_with_session ____________________________
[  106s] 
[  106s]     async def test_async_with_session() -> None:
[  106s] >       with pytest.warns(None) as cm:
[  106s] 
[  106s] 
[  106s] tests/test_client_functional.py:2431: 
[  106s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  106s] 
[  106s] self = WarningsChecker(record=True), expected_warning = None, match_expr = None
[  106s] 
[  106s]     def __init__(
[  106s]         self,
[  106s]         expected_warning: Optional[
[  106s]             Union[Type[Warning], Tuple[Type[Warning], ...]]
[  106s]         ] = Warning,
[  106s]         match_expr: Optional[Union[str, Pattern[str]]] = None,
[  106s]         *,
[  106s]         _ispytest: bool = False,
[  106s]     ) -> None:
[  106s]         check_ispytest(_ispytest)
[  106s]         super().__init__(_ispytest=True)
[  106s]     
[  106s]         msg = "exceptions must be derived from Warning, not %s"
[  106s]         if expected_warning is None:
[  106s] >           warnings.warn(WARNS_NONE_ARG, stacklevel=4)
[  106s] E           pytest.PytestRemovedIn8Warning: Passing None has been deprecated.
[  106s] E           See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.
[  106s] 
[  106s] __class__  = <class '_pytest.recwarn.WarningsChecker'>
[  106s] _ispytest  = True
[  106s] expected_warning = None
[  106s] match_expr = None
[  106s] msg        = 'exceptions must be derived from Warning, not %s'
[  106s] self       = WarningsChecker(record=True)
[  106s] 
[  106s] /usr/lib/python3.9/site-packages/_pytest/recwarn.py:246: PytestRemovedIn8Warning
[  106s] _________________________ test_session_close_awaitable _________________________
[  106s] 
[  106s]     async def test_session_close_awaitable() -> None:
[  106s]         session = aiohttp.ClientSession()
[  106s] >       with pytest.warns(None) as cm:
[  106s] 
[  106s] session    = <aiohttp.client.ClientSession object at 0x7f74353d5400>
[  106s] 
[  106s] tests/test_client_functional.py:2441: 
[  106s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  106s] /usr/lib/python3.9/site-packages/_pytest/recwarn.py:246: in __init__
[  106s]     warnings.warn(WARNS_NONE_ARG, stacklevel=4)
[  106s]         __class__  = <class '_pytest.recwarn.WarningsChecker'>
[  106s]         _ispytest  = True
[  106s]         expected_warning = None
[  106s]         match_expr = None
[  106s]         msg        = 'exceptions must be derived from Warning, not %s'
[  106s]         self       = WarningsChecker(record=True)
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:338: in from_call
[  106s]     result: Optional[TResult] = func()
[  106s]         cls        = <class '_pytest.runner.CallInfo'>
[  106s]         duration   = 0.0002979149999191577
[  106s]         excinfo    = <ExceptionInfo PytestRemovedIn8Warning('Passing None has been deprecated.\nSee https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.') tblen=2>
[  106s]         func       = <function call_runtest_hook.<locals>.<lambda> at 0x7f74333c05e0>
[  106s]         precise_start = 880.992611685
[  106s]         precise_stop = 880.9929096
[  106s]         reraise    = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
[  106s]         result     = None
[  106s]         start      = 1648463406.1733868
[  106s]         stop       = 1648463406.1736853
[  106s]         when       = 'call'
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:259: in <lambda>
[  106s]     lambda: ihook(item=item, **kwds), when=when, reraise=reraise
[  106s]         ihook      = <_HookCaller 'pytest_runtest_call'>
[  106s]         item       = <Function test_async_with_session>
[  106s]         kwds       = {}
[  106s] /usr/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
[  106s]     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
[  106s]         argname    = 'item'
[  106s]         args       = ()
[  106s]         firstresult = False
[  106s]         kwargs     = {'item': <Function test_async_with_session>}
[  106s]         self       = <_HookCaller 'pytest_runtest_call'>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
[  106s]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[  106s]         firstresult = False
[  106s]         hook_name  = 'pytest_runtest_call'
[  106s]         kwargs     = {'item': <Function test_async_with_session>}
[  106s]         methods    = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.9/site-packages/_pytest/runner.py'>>,
[  106s]  <HookImpl plugin_name='skipping', plugin=<module '_pytest.skipping' from '/usr/lib/python3.9/site-packages/_pytest/skipping.py'>>,
[  106s]  <HookImpl plugin_name='timeout', plugin=<module 'pytest_timeout' from '/usr/lib/python3.9/site-packages/pytest_timeout.py'>>,
[  106s]  <HookImpl plugin_name='capturemanager', plugin=<CaptureManager _method='fd' _global_capturing=<MultiCapture out=<FDCapture 1 oldfd=5 _state='suspended' tmpfile=<_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>> err=<FDCapture 2 oldfd=7 _state='suspended' tmpfile=<_io.TextIOWrapper name="<_io.FileIO name=8 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>> in_=<FDCapture 0 oldfd=3 _state='started' tmpfile=<_io.TextIOWrapper name='/dev/null' mode='r' encoding='UTF-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>>,
[  106s]  <HookImpl plugin_name='logging-plugin', plugin=<_pytest.logging.LoggingPlugin object at 0x7f7435a2d910>>,
[  106s]  <HookImpl plugin_name='unraisableexception', plugin=<module '_pytest.unraisableexception' from '/usr/lib/python3.9/site-packages/_pytest/unraisableexception.py'>>,
[  106s]  <HookImpl plugin_name='threadexception', plugin=<module '_pytest.threadexception' from '/usr/lib/python3.9/site-packages/_pytest/threadexception.py'>>]
[  106s]         self       = <_pytest.config.PytestPluginManager object at 0x7f7437ca8f70>
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:174: in pytest_runtest_call
[  106s]     raise e
[  106s]         item       = <Function test_async_with_session>
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:166: in pytest_runtest_call
[  106s]     item.runtest()
[  106s]         item       = <Function test_async_with_session>
[  106s] /usr/lib/python3.9/site-packages/_pytest/python.py:1761: in runtest
[  106s]     self.ihook.pytest_pyfunc_call(pyfuncitem=self)
[  106s]         self       = <Function test_async_with_session>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
[  106s]     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
[  106s]         argname    = 'pyfuncitem'
[  106s]         args       = ()
[  106s]         firstresult = True
[  106s]         kwargs     = {'pyfuncitem': <Function test_async_with_session>}
[  106s]         self       = <_HookCaller 'pytest_pyfunc_call'>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
[  106s]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[  106s]         firstresult = True
[  106s]         hook_name  = 'pytest_pyfunc_call'
[  106s]         kwargs     = {'pyfuncitem': <Function test_async_with_session>}
[  106s]         methods    = [<HookImpl plugin_name='python', plugin=<module '_pytest.python' from '/usr/lib/python3.9/site-packages/_pytest/python.py'>>,
[  106s]  <HookImpl plugin_name='aiohttp.pytest_plugin', plugin=<module 'aiohttp.pytest_plugin' from '/home/abuild/rpmbuild/BUILDROOT/python-aiohttp-3.8.1-0.x86_64/usr/lib64/python3.9/site-packages/aiohttp/pytest_plugin.py'>>]
[  106s]         self       = <_pytest.config.PytestPluginManager object at 0x7f7437ca8f70>
[  106s] ../../BUILDROOT/python-aiohttp-3.8.1-0.x86_64/usr/lib64/python3.9/site-packages/aiohttp/pytest_plugin.py:186: in pytest_pyfunc_call
[  106s]     _loop.run_until_complete(pyfuncitem.obj(**testargs))
[  106s]         _loop      = <_UnixSelectorEventLoop running=False closed=False debug=False>
[  106s]         existing_loop = None
[  106s]         fast       = False
[  106s]         pyfuncitem = <Function test_async_with_session>
[  106s]         testargs   = {}
[  106s] /usr/lib64/python3.9/asyncio/base_events.py:642: in run_until_complete
[  106s]     return future.result()
[  106s]         future     = <Task finished name='Task-1096' coro=<test_async_with_session() done, defined at /home/abuild/rpmbuild/BUILD/aiohttp-3.8.1/tests/test_client_functional.py:2430> exception=PytestRemovedIn8Warning('Passing None has been deprecated.\nSee https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.')>
[  106s]         new_task   = True
[  106s]         self       = <_UnixSelectorEventLoop running=False closed=False debug=False>
[  106s] tests/test_client_functional.py:2431: in test_async_with_session
[  106s]     with pytest.warns(None) as cm:
[  106s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  106s] 
[  106s] self = WarningsChecker(record=True), expected_warning = None, match_expr = None
[  106s] 
[  106s]     def __init__(
[  106s]         self,
[  106s]         expected_warning: Optional[
[  106s]             Union[Type[Warning], Tuple[Type[Warning], ...]]
[  106s]         ] = Warning,
[  106s]         match_expr: Optional[Union[str, Pattern[str]]] = None,
[  106s]         *,
[  106s]         _ispytest: bool = False,
[  106s]     ) -> None:
[  106s]         check_ispytest(_ispytest)
[  106s]         super().__init__(_ispytest=True)
[  106s]     
[  106s]         msg = "exceptions must be derived from Warning, not %s"
[  106s]         if expected_warning is None:
[  106s] >           warnings.warn(WARNS_NONE_ARG, stacklevel=4)
[  106s] E           pytest.PytestRemovedIn8Warning: Passing None has been deprecated.
[  106s] E           See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.
[  106s] 
[  106s] __class__  = <class '_pytest.recwarn.WarningsChecker'>
[  106s] _ispytest  = True
[  106s] expected_warning = None
[  106s] match_expr = None
[  106s] msg        = 'exceptions must be derived from Warning, not %s'
[  106s] self       = WarningsChecker(record=True)
[  106s] 
[  106s] /usr/lib/python3.9/site-packages/_pytest/recwarn.py:246: PytestRemovedIn8Warning
[  106s] _________________ test_close_run_until_complete_not_deprecated _________________
[  106s] 
[  106s]     async def test_close_run_until_complete_not_deprecated() -> None:
[  106s]         session = aiohttp.ClientSession()
[  106s]     
[  106s] >       with pytest.warns(None) as cm:
[  106s] 
[  106s] session    = <aiohttp.client.ClientSession object at 0x7f74330d5100>
[  106s] 
[  106s] tests/test_client_functional.py:2451: 
[  106s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  106s] /usr/lib/python3.9/site-packages/_pytest/recwarn.py:246: in __init__
[  106s]     warnings.warn(WARNS_NONE_ARG, stacklevel=4)
[  106s]         __class__  = <class '_pytest.recwarn.WarningsChecker'>
[  106s]         _ispytest  = True
[  106s]         expected_warning = None
[  106s]         match_expr = None
[  106s]         msg        = 'exceptions must be derived from Warning, not %s'
[  106s]         self       = WarningsChecker(record=True)
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:338: in from_call
[  106s]     result: Optional[TResult] = func()
[  106s]         cls        = <class '_pytest.runner.CallInfo'>
[  106s]         duration   = 0.00033854299999802606
[  106s]         excinfo    = <ExceptionInfo PytestRemovedIn8Warning('Passing None has been deprecated.\nSee https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.') tblen=15>
[  106s]         func       = <function call_runtest_hook.<locals>.<lambda> at 0x7f7434aa0dc0>
[  106s]         precise_start = 881.032735979
[  106s]         precise_stop = 881.033074522
[  106s]         reraise    = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
[  106s]         result     = None
[  106s]         start      = 1648463406.2135112
[  106s]         stop       = 1648463406.21385
[  106s]         when       = 'call'
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:259: in <lambda>
[  106s]     lambda: ihook(item=item, **kwds), when=when, reraise=reraise
[  106s]         ihook      = <_HookCaller 'pytest_runtest_call'>
[  106s]         item       = <Function test_session_close_awaitable>
[  106s]         kwds       = {}
[  106s] /usr/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
[  106s]     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
[  106s]         argname    = 'item'
[  106s]         args       = ()
[  106s]         firstresult = False
[  106s]         kwargs     = {'item': <Function test_session_close_awaitable>}
[  106s]         self       = <_HookCaller 'pytest_runtest_call'>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
[  106s]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[  106s]         firstresult = False
[  106s]         hook_name  = 'pytest_runtest_call'
[  106s]         kwargs     = {'item': <Function test_session_close_awaitable>}
[  106s]         methods    = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.9/site-packages/_pytest/runner.py'>>,
[  106s]  <HookImpl plugin_name='skipping', plugin=<module '_pytest.skipping' from '/usr/lib/python3.9/site-packages/_pytest/skipping.py'>>,
[  106s]  <HookImpl plugin_name='timeout', plugin=<module 'pytest_timeout' from '/usr/lib/python3.9/site-packages/pytest_timeout.py'>>,
[  106s]  <HookImpl plugin_name='capturemanager', plugin=<CaptureManager _method='fd' _global_capturing=<MultiCapture out=<FDCapture 1 oldfd=5 _state='suspended' tmpfile=<_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>> err=<FDCapture 2 oldfd=7 _state='suspended' tmpfile=<_io.TextIOWrapper name="<_io.FileIO name=8 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>> in_=<FDCapture 0 oldfd=3 _state='started' tmpfile=<_io.TextIOWrapper name='/dev/null' mode='r' encoding='UTF-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>>,
[  106s]  <HookImpl plugin_name='logging-plugin', plugin=<_pytest.logging.LoggingPlugin object at 0x7f7435a2d910>>,
[  106s]  <HookImpl plugin_name='unraisableexception', plugin=<module '_pytest.unraisableexception' from '/usr/lib/python3.9/site-packages/_pytest/unraisableexception.py'>>,
[  106s]  <HookImpl plugin_name='threadexception', plugin=<module '_pytest.threadexception' from '/usr/lib/python3.9/site-packages/_pytest/threadexception.py'>>]
[  106s]         self       = <_pytest.config.PytestPluginManager object at 0x7f7437ca8f70>
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:174: in pytest_runtest_call
[  106s]     raise e
[  106s]         item       = <Function test_session_close_awaitable>
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:166: in pytest_runtest_call
[  106s]     item.runtest()
[  106s]         item       = <Function test_session_close_awaitable>
[  106s] /usr/lib/python3.9/site-packages/_pytest/python.py:1761: in runtest
[  106s]     self.ihook.pytest_pyfunc_call(pyfuncitem=self)
[  106s]         self       = <Function test_session_close_awaitable>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
[  106s]     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
[  106s]         argname    = 'pyfuncitem'
[  106s]         args       = ()
[  106s]         firstresult = True
[  106s]         kwargs     = {'pyfuncitem': <Function test_session_close_awaitable>}
[  106s]         self       = <_HookCaller 'pytest_pyfunc_call'>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
[  106s]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[  106s]         firstresult = True
[  106s]         hook_name  = 'pytest_pyfunc_call'
[  106s]         kwargs     = {'pyfuncitem': <Function test_session_close_awaitable>}
[  106s]         methods    = [<HookImpl plugin_name='python', plugin=<module '_pytest.python' from '/usr/lib/python3.9/site-packages/_pytest/python.py'>>,
[  106s]  <HookImpl plugin_name='aiohttp.pytest_plugin', plugin=<module 'aiohttp.pytest_plugin' from '/home/abuild/rpmbuild/BUILDROOT/python-aiohttp-3.8.1-0.x86_64/usr/lib64/python3.9/site-packages/aiohttp/pytest_plugin.py'>>]
[  106s]         self       = <_pytest.config.PytestPluginManager object at 0x7f7437ca8f70>
[  106s] ../../BUILDROOT/python-aiohttp-3.8.1-0.x86_64/usr/lib64/python3.9/site-packages/aiohttp/pytest_plugin.py:186: in pytest_pyfunc_call
[  106s]     _loop.run_until_complete(pyfuncitem.obj(**testargs))
[  106s]         _loop      = <_UnixSelectorEventLoop running=False closed=False debug=False>
[  106s]         existing_loop = None
[  106s]         fast       = False
[  106s]         pyfuncitem = <Function test_session_close_awaitable>
[  106s]         testargs   = {}
[  106s] /usr/lib64/python3.9/asyncio/base_events.py:642: in run_until_complete
[  106s]     return future.result()
[  106s]         future     = <Task finished name='Task-1097' coro=<test_session_close_awaitable() done, defined at /home/abuild/rpmbuild/BUILD/aiohttp-3.8.1/tests/test_client_functional.py:2439> exception=PytestRemovedIn8Warning('Passing None has been deprecated.\nSee https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.')>
[  106s]         new_task   = True
[  106s]         self       = <_UnixSelectorEventLoop running=False closed=False debug=False>
[  106s] tests/test_client_functional.py:2441: in test_session_close_awaitable
[  106s]     with pytest.warns(None) as cm:
[  106s]         session    = <aiohttp.client.ClientSession object at 0x7f74353d5400>
[  106s] /usr/lib/python3.9/site-packages/_pytest/recwarn.py:246: in __init__
[  106s]     warnings.warn(WARNS_NONE_ARG, stacklevel=4)
[  106s]         __class__  = <class '_pytest.recwarn.WarningsChecker'>
[  106s]         _ispytest  = True
[  106s]         expected_warning = None
[  106s]         match_expr = None
[  106s]         msg        = 'exceptions must be derived from Warning, not %s'
[  106s]         self       = WarningsChecker(record=True)
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:338: in from_call
[  106s]     result: Optional[TResult] = func()
[  106s]         cls        = <class '_pytest.runner.CallInfo'>
[  106s]         duration   = 0.0002979149999191577
[  106s]         excinfo    = <ExceptionInfo PytestRemovedIn8Warning('Passing None has been deprecated.\nSee https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.') tblen=2>
[  106s]         func       = <function call_runtest_hook.<locals>.<lambda> at 0x7f74333c05e0>
[  106s]         precise_start = 880.992611685
[  106s]         precise_stop = 880.9929096
[  106s]         reraise    = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
[  106s]         result     = None
[  106s]         start      = 1648463406.1733868
[  106s]         stop       = 1648463406.1736853
[  106s]         when       = 'call'
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:259: in <lambda>
[  106s]     lambda: ihook(item=item, **kwds), when=when, reraise=reraise
[  106s]         ihook      = <_HookCaller 'pytest_runtest_call'>
[  106s]         item       = <Function test_async_with_session>
[  106s]         kwds       = {}
[  106s] /usr/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
[  106s]     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
[  106s]         argname    = 'item'
[  106s]         args       = ()
[  106s]         firstresult = False
[  106s]         kwargs     = {'item': <Function test_async_with_session>}
[  106s]         self       = <_HookCaller 'pytest_runtest_call'>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
[  106s]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[  106s]         firstresult = False
[  106s]         hook_name  = 'pytest_runtest_call'
[  106s]         kwargs     = {'item': <Function test_async_with_session>}
[  106s]         methods    = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.9/site-packages/_pytest/runner.py'>>,
[  106s]  <HookImpl plugin_name='skipping', plugin=<module '_pytest.skipping' from '/usr/lib/python3.9/site-packages/_pytest/skipping.py'>>,
[  106s]  <HookImpl plugin_name='timeout', plugin=<module 'pytest_timeout' from '/usr/lib/python3.9/site-packages/pytest_timeout.py'>>,
[  106s]  <HookImpl plugin_name='capturemanager', plugin=<CaptureManager _method='fd' _global_capturing=<MultiCapture out=<FDCapture 1 oldfd=5 _state='suspended' tmpfile=<_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>> err=<FDCapture 2 oldfd=7 _state='suspended' tmpfile=<_io.TextIOWrapper name="<_io.FileIO name=8 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>> in_=<FDCapture 0 oldfd=3 _state='started' tmpfile=<_io.TextIOWrapper name='/dev/null' mode='r' encoding='UTF-8'>> _state='suspended' _in_suspended=False> _capture_fixture=None>>,
[  106s]  <HookImpl plugin_name='logging-plugin', plugin=<_pytest.logging.LoggingPlugin object at 0x7f7435a2d910>>,
[  106s]  <HookImpl plugin_name='unraisableexception', plugin=<module '_pytest.unraisableexception' from '/usr/lib/python3.9/site-packages/_pytest/unraisableexception.py'>>,
[  106s]  <HookImpl plugin_name='threadexception', plugin=<module '_pytest.threadexception' from '/usr/lib/python3.9/site-packages/_pytest/threadexception.py'>>]
[  106s]         self       = <_pytest.config.PytestPluginManager object at 0x7f7437ca8f70>
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:174: in pytest_runtest_call
[  106s]     raise e
[  106s]         item       = <Function test_async_with_session>
[  106s] /usr/lib/python3.9/site-packages/_pytest/runner.py:166: in pytest_runtest_call
[  106s]     item.runtest()
[  106s]         item       = <Function test_async_with_session>
[  106s] /usr/lib/python3.9/site-packages/_pytest/python.py:1761: in runtest
[  106s]     self.ihook.pytest_pyfunc_call(pyfuncitem=self)
[  106s]         self       = <Function test_async_with_session>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
[  106s]     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
[  106s]         argname    = 'pyfuncitem'
[  106s]         args       = ()
[  106s]         firstresult = True
[  106s]         kwargs     = {'pyfuncitem': <Function test_async_with_session>}
[  106s]         self       = <_HookCaller 'pytest_pyfunc_call'>
[  106s] /usr/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
[  106s]     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
[  106s]         firstresult = True
[  106s]         hook_name  = 'pytest_pyfunc_call'
[  106s]         kwargs     = {'pyfuncitem': <Function test_async_with_session>}
[  106s]         methods    = [<HookImpl plugin_name='python', plugin=<module '_pytest.python' from '/usr/lib/python3.9/site-packages/_pytest/python.py'>>,
[  106s]  <HookImpl plugin_name='aiohttp.pytest_plugin', plugin=<module 'aiohttp.pytest_plugin' from '/home/abuild/rpmbuild/BUILDROOT/python-aiohttp-3.8.1-0.x86_64/usr/lib64/python3.9/site-packages/aiohttp/pytest_plugin.py'>>]
[  106s]         self       = <_pytest.config.PytestPluginManager object at 0x7f7437ca8f70>
[  106s] ../../BUILDROOT/python-aiohttp-3.8.1-0.x86_64/usr/lib64/python3.9/site-packages/aiohttp/pytest_plugin.py:186: in pytest_pyfunc_call
[  106s]     _loop.run_until_complete(pyfuncitem.obj(**testargs))
[  106s]         _loop      = <_UnixSelectorEventLoop running=False closed=False debug=False>
[  106s]         existing_loop = None
[  106s]         fast       = False
[  106s]         pyfuncitem = <Function test_async_with_session>
[  106s]         testargs   = {}
[  106s] /usr/lib64/python3.9/asyncio/base_events.py:642: in run_until_complete
[  106s]     return future.result()
[  106s]         future     = <Task finished name='Task-1096' coro=<test_async_with_session() done, defined at /home/abuild/rpmbuild/BUILD/aiohttp-3.8.1/tests/test_client_functional.py:2430> exception=PytestRemovedIn8Warning('Passing None has been deprecated.\nSee https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.')>
[  106s]         new_task   = True
[  106s]         self       = <_UnixSelectorEventLoop running=False closed=False debug=False>
[  106s] tests/test_client_functional.py:2431: in test_async_with_session
[  106s]     with pytest.warns(None) as cm:
[  106s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  106s] 
[  106s] self = WarningsChecker(record=True), expected_warning = None, match_expr = None
[  106s] 
[  106s]     def __init__(
[  106s]         self,
[  106s]         expected_warning: Optional[
[  106s]             Union[Type[Warning], Tuple[Type[Warning], ...]]
[  106s]         ] = Warning,
[  106s]         match_expr: Optional[Union[str, Pattern[str]]] = None,
[  106s]         *,
[  106s]         _ispytest: bool = False,
[  106s]     ) -> None:
[  106s]         check_ispytest(_ispytest)
[  106s]         super().__init__(_ispytest=True)
[  106s]     
[  106s]         msg = "exceptions must be derived from Warning, not %s"
[  106s]         if expected_warning is None:
[  106s] >           warnings.warn(WARNS_NONE_ARG, stacklevel=4)
[  106s] E           pytest.PytestRemovedIn8Warning: Passing None has been deprecated.
[  106s] E           See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.
[  106s] 
[  106s] __class__  = <class '_pytest.recwarn.WarningsChecker'>
[  106s] _ispytest  = True
[  106s] expected_warning = None
[  106s] match_expr = None
[  106s] msg        = 'exceptions must be derived from Warning, not %s'
[  106s] self       = WarningsChecker(record=True)
[  106s] 
[  106s] /usr/lib/python3.9/site-packages/_pytest/recwarn.py:246: PytestRemovedIn8Warning

Python Version

[   22s] ============================= test session starts ==============================
[   22s] platform linux -- Python 3.9.10, pytest-7.1.1, pluggy-1.0.0 -- /usr/bin/python3.9
[   22s] cachedir: .pytest_cache
[   22s] rootdir: /home/abuild/rpmbuild/BUILD/aiohttp-3.8.1, configfile: setup.cfg, testpaths: tests/
[   22s] plugins: timeout-2.0.2, mock-3.6.1

aiohttp Version

3.8.1

multidict Version

6.0.2

yarl Version

1.7.2

OS

openSUSE Tumbleweed Linux

Related component

Server, Client

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
@bnavigator bnavigator added the bug label Mar 28, 2022
@Dreamsorcerer
Copy link
Member

These are generally caught automatically by Dependabot PRs (e.g. #6596), so need to report them. Feel free to make a PR to resolve the issue though.

@bnavigator
Copy link
Contributor Author

bnavigator commented Mar 28, 2022

  1. I reported it, because the openSUSE python manager asked me to
  2. Because of Bump pytest from 6.2.5 to 7.0.0 #6596 (comment) your bot is stale.

@Dreamsorcerer
Copy link
Member

Yep, there are some issues with our Dependabot integration at the moment. But, if it's got an open PR, we should end up looking at it eventually. As mentioned, a PR will help get it updated quickly, if someone else gets to it before a maintainer.

@bnavigator
Copy link
Contributor Author

Feel free to make a PR to resolve the issue though.

It's unfortunately not obvious, what was the intention behind your pytest.warns(None) usage. As described in https://docs.pytest.org/en/latest/deprecations.html#using-pytest-warns-none and https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests there were multiple (mis-)uses.

As mentioned, a PR will help get it updated quickly

Hence the detailed report including the analysis. A bot cannot do that for you.

@bnavigator bnavigator reopened this Mar 28, 2022
@Dreamsorcerer
Copy link
Member

So, the "misuse" is using it to ensure that no warnings happen? If so, it looks like that is exactly what happened, judging by the commit from several years ago: #2161

If that's the case, then I'm sure we can just delete the lines. We have pytest configured to error on warnings anyway (maybe that wasn't the case when this commit was made).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants