Bug 2059944

Summary: python-aiohttp fails to build with pytest 7
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-aiohttpAssignee: Fabian Affolter <mail>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: athmanem, igor.raits, mail, python-sig
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-aiohttp-3.8.1-4.fc37 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-28 06:58:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2045102, 2050629    

Description Miro Hrončok 2022-03-02 11:40:38 UTC
In this copr repo, I have updated pytest to 7.0.1:

https://copr.fedorainfracloud.org/coprs/churchyard/pytest-7/

Based on this PR:

https://src.fedoraproject.org/rpms/pytest/pull-request/25

I'd like to update pytest to 7 in Fedora 37, but python-aiohttp 3.8.1-3 fails to build.


https://copr.fedorainfracloud.org/coprs/churchyard/pytest-7/package/python-aiohttp/

=================================== FAILURES ===================================
___________________________ test_async_with_session ____________________________

    async def test_async_with_session() -> None:
>       with pytest.warns(None) as cm:


tests/test_client_functional.py:2431: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = WarningsChecker(record=True), expected_warning = None, match_expr = None

    def __init__(
        self,
        expected_warning: Optional[
            Union[Type[Warning], Tuple[Type[Warning], ...]]
        ] = Warning,
        match_expr: Optional[Union[str, Pattern[str]]] = None,
        *,
        _ispytest: bool = False,
    ) -> None:
        check_ispytest(_ispytest)
        super().__init__(_ispytest=True)
    
        msg = "exceptions must be derived from Warning, not %s"
        if expected_warning is None:
>           warnings.warn(WARNS_NONE_ARG, stacklevel=4)
E           pytest.PytestRemovedIn8Warning: Passing None has been deprecated.
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.

__class__  = <class '_pytest.recwarn.WarningsChecker'>
_ispytest  = True
expected_warning = None
match_expr = None
msg        = 'exceptions must be derived from Warning, not %s'
self       = WarningsChecker(record=True)

/usr/lib/python3.10/site-packages/_pytest/recwarn.py:246: PytestRemovedIn8Warning
_________________________ test_session_close_awaitable _________________________

    async def test_session_close_awaitable() -> None:
        session = aiohttp.ClientSession()
>       with pytest.warns(None) as cm:

session    = <aiohttp.client.ClientSession object at 0x7fe5b0717550>

tests/test_client_functional.py:2441: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/site-packages/_pytest/recwarn.py:246: in __init__
    warnings.warn(WARNS_NONE_ARG, stacklevel=4)
        __class__  = <class '_pytest.recwarn.WarningsChecker'>
        _ispytest  = True
        expected_warning = None
        match_expr = None
        msg        = 'exceptions must be derived from Warning, not %s'
        self       = WarningsChecker(record=True)
/usr/lib/python3.10/site-packages/_pytest/runner.py:340: in from_call
    result: Optional[TResult] = func()
        cls        = <class '_pytest.runner.CallInfo'>
        duration   = 0.000731401000052756
        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>
        func       = <function call_runtest_hook.<locals>.<lambda> at 0x7fe5af89f490>
        precise_start = 391.222989243
        precise_stop = 391.223720644
        reraise    = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
        result     = None
        start      = 1646216950.6166382
        stop       = 1646216950.6173723
        when       = 'call'
/usr/lib/python3.10/site-packages/_pytest/runner.py:261: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
        ihook      = <_HookCaller 'pytest_runtest_call'>
        item       = <Function test_async_with_session>
        kwds       = {}
/usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
        argname    = 'item'
        args       = ()
        firstresult = False
        kwargs     = {'item': <Function test_async_with_session>}
        self       = <_HookCaller 'pytest_runtest_call'>
/usr/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = False
        hook_name  = 'pytest_runtest_call'
        kwargs     = {'item': <Function test_async_with_session>}
        methods    = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.10/site-packages/_pytest/runne...ption', plugin=<module '_pytest.threadexception' from '/usr/lib/python3.10/site-packages/_pytest/threadexception.py'>>]
        self       = <_pytest.config.PytestPluginManager object at 0x7fe5b2d882b0>
/usr/lib/python3.10/site-packages/_pytest/runner.py:176: in pytest_runtest_call
    raise e
        item       = <Function test_async_with_session>
/usr/lib/python3.10/site-packages/_pytest/runner.py:168: in pytest_runtest_call
    item.runtest()
        item       = <Function test_async_with_session>
/usr/lib/python3.10/site-packages/_pytest/python.py:1718: in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
        self       = <Function test_async_with_session>
/usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
        argname    = 'pyfuncitem'
        args       = ()
        firstresult = True
        kwargs     = {'pyfuncitem': <Function test_async_with_session>}
        self       = <_HookCaller 'pytest_pyfunc_call'>
/usr/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = True
        hook_name  = 'pytest_pyfunc_call'
        kwargs     = {'pyfuncitem': <Function test_async_with_session>}
        methods    = [<HookImpl plugin_name='python', plugin=<module '_pytest.python' from '/usr/lib/python3.10/site-packages/_pytest/pytho...ddir/build/BUILDROOT/python-aiohttp-3.8.1-3.fc37.x86_64/usr/lib64/python3.10/site-packages/aiohttp/pytest_plugin.py'>>]
        self       = <_pytest.config.PytestPluginManager object at 0x7fe5b2d882b0>
../../BUILDROOT/python-aiohttp-3.8.1-3.fc37.x86_64/usr/lib64/python3.10/site-packages/aiohttp/pytest_plugin.py:186: in pytest_pyfunc_call
    _loop.run_until_complete(pyfuncitem.obj(**testargs))
        _loop      = <_UnixSelectorEventLoop running=False closed=False debug=False>
        existing_loop = None
        fast       = False
        pyfuncitem = <Function test_async_with_session>
        testargs   = {}
/usr/lib64/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
        future     = <Task finished name='Task-1096' coro=<test_async_with_session() done, defined at /builddir/build/BUILD/aiohttp-3.8.1/t.../latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.')>
        new_task   = True
        self       = <_UnixSelectorEventLoop running=False closed=False debug=False>
tests/test_client_functional.py:2431: in test_async_with_session
    with pytest.warns(None) as cm:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = WarningsChecker(record=True), expected_warning = None, match_expr = None

    def __init__(
        self,
        expected_warning: Optional[
            Union[Type[Warning], Tuple[Type[Warning], ...]]
        ] = Warning,
        match_expr: Optional[Union[str, Pattern[str]]] = None,
        *,
        _ispytest: bool = False,
    ) -> None:
        check_ispytest(_ispytest)
        super().__init__(_ispytest=True)
    
        msg = "exceptions must be derived from Warning, not %s"
        if expected_warning is None:
>           warnings.warn(WARNS_NONE_ARG, stacklevel=4)
E           pytest.PytestRemovedIn8Warning: Passing None has been deprecated.
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.

__class__  = <class '_pytest.recwarn.WarningsChecker'>
_ispytest  = True
expected_warning = None
match_expr = None
msg        = 'exceptions must be derived from Warning, not %s'
self       = WarningsChecker(record=True)

/usr/lib/python3.10/site-packages/_pytest/recwarn.py:246: PytestRemovedIn8Warning
_________________ test_close_run_until_complete_not_deprecated _________________

    async def test_close_run_until_complete_not_deprecated() -> None:
        session = aiohttp.ClientSession()
    
>       with pytest.warns(None) as cm:

session    = <aiohttp.client.ClientSession object at 0x7fe5b05c3850>

tests/test_client_functional.py:2451: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/site-packages/_pytest/recwarn.py:246: in __init__
    warnings.warn(WARNS_NONE_ARG, stacklevel=4)
        __class__  = <class '_pytest.recwarn.WarningsChecker'>
        _ispytest  = True
        expected_warning = None
        match_expr = None
        msg        = 'exceptions must be derived from Warning, not %s'
        self       = WarningsChecker(record=True)
/usr/lib/python3.10/site-packages/_pytest/runner.py:340: in from_call
    result: Optional[TResult] = func()
        cls        = <class '_pytest.runner.CallInfo'>
        duration   = 0.0007768809999788573
        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>
        func       = <function call_runtest_hook.<locals>.<lambda> at 0x7fe5af7697e0>
        precise_start = 391.29095415
        precise_stop = 391.291731031
        reraise    = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
        result     = None
        start      = 1646216950.684603
        stop       = 1646216950.6853824
        when       = 'call'
/usr/lib/python3.10/site-packages/_pytest/runner.py:261: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
        ihook      = <_HookCaller 'pytest_runtest_call'>
        item       = <Function test_session_close_awaitable>
        kwds       = {}
/usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
        argname    = 'item'
        args       = ()
        firstresult = False
        kwargs     = {'item': <Function test_session_close_awaitable>}
        self       = <_HookCaller 'pytest_runtest_call'>
/usr/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = False
        hook_name  = 'pytest_runtest_call'
        kwargs     = {'item': <Function test_session_close_awaitable>}
        methods    = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.10/site-packages/_pytest/runne...ption', plugin=<module '_pytest.threadexception' from '/usr/lib/python3.10/site-packages/_pytest/threadexception.py'>>]
        self       = <_pytest.config.PytestPluginManager object at 0x7fe5b2d882b0>
/usr/lib/python3.10/site-packages/_pytest/runner.py:176: in pytest_runtest_call
    raise e
        item       = <Function test_session_close_awaitable>
/usr/lib/python3.10/site-packages/_pytest/runner.py:168: in pytest_runtest_call
    item.runtest()
        item       = <Function test_session_close_awaitable>
/usr/lib/python3.10/site-packages/_pytest/python.py:1718: in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
        self       = <Function test_session_close_awaitable>
/usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
        argname    = 'pyfuncitem'
        args       = ()
        firstresult = True
        kwargs     = {'pyfuncitem': <Function test_session_close_awaitable>}
        self       = <_HookCaller 'pytest_pyfunc_call'>
/usr/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = True
        hook_name  = 'pytest_pyfunc_call'
        kwargs     = {'pyfuncitem': <Function test_session_close_awaitable>}
        methods    = [<HookImpl plugin_name='python', plugin=<module '_pytest.python' from '/usr/lib/python3.10/site-packages/_pytest/pytho...ddir/build/BUILDROOT/python-aiohttp-3.8.1-3.fc37.x86_64/usr/lib64/python3.10/site-packages/aiohttp/pytest_plugin.py'>>]
        self       = <_pytest.config.PytestPluginManager object at 0x7fe5b2d882b0>
../../BUILDROOT/python-aiohttp-3.8.1-3.fc37.x86_64/usr/lib64/python3.10/site-packages/aiohttp/pytest_plugin.py:186: in pytest_pyfunc_call
    _loop.run_until_complete(pyfuncitem.obj(**testargs))
        _loop      = <_UnixSelectorEventLoop running=False closed=False debug=False>
        existing_loop = None
        fast       = False
        pyfuncitem = <Function test_session_close_awaitable>
        testargs   = {}
/usr/lib64/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
        future     = <Task finished name='Task-1097' coro=<test_session_close_awaitable() done, defined at /builddir/build/BUILD/aiohttp-3..../latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.')>
        new_task   = True
        self       = <_UnixSelectorEventLoop running=False closed=False debug=False>
tests/test_client_functional.py:2441: in test_session_close_awaitable
    with pytest.warns(None) as cm:
        session    = <aiohttp.client.ClientSession object at 0x7fe5b0717550>
/usr/lib/python3.10/site-packages/_pytest/recwarn.py:246: in __init__
    warnings.warn(WARNS_NONE_ARG, stacklevel=4)
        __class__  = <class '_pytest.recwarn.WarningsChecker'>
        _ispytest  = True
        expected_warning = None
        match_expr = None
        msg        = 'exceptions must be derived from Warning, not %s'
        self       = WarningsChecker(record=True)
/usr/lib/python3.10/site-packages/_pytest/runner.py:340: in from_call
    result: Optional[TResult] = func()
        cls        = <class '_pytest.runner.CallInfo'>
        duration   = 0.000731401000052756
        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>
        func       = <function call_runtest_hook.<locals>.<lambda> at 0x7fe5af89f490>
        precise_start = 391.222989243
        precise_stop = 391.223720644
        reraise    = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
        result     = None
        start      = 1646216950.6166382
        stop       = 1646216950.6173723
        when       = 'call'
/usr/lib/python3.10/site-packages/_pytest/runner.py:261: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
        ihook      = <_HookCaller 'pytest_runtest_call'>
        item       = <Function test_async_with_session>
        kwds       = {}
/usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
        argname    = 'item'
        args       = ()
        firstresult = False
        kwargs     = {'item': <Function test_async_with_session>}
        self       = <_HookCaller 'pytest_runtest_call'>
/usr/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = False
        hook_name  = 'pytest_runtest_call'
        kwargs     = {'item': <Function test_async_with_session>}
        methods    = [<HookImpl plugin_name='runner', plugin=<module '_pytest.runner' from '/usr/lib/python3.10/site-packages/_pytest/runne...ption', plugin=<module '_pytest.threadexception' from '/usr/lib/python3.10/site-packages/_pytest/threadexception.py'>>]
        self       = <_pytest.config.PytestPluginManager object at 0x7fe5b2d882b0>
/usr/lib/python3.10/site-packages/_pytest/runner.py:176: in pytest_runtest_call
    raise e
        item       = <Function test_async_with_session>
/usr/lib/python3.10/site-packages/_pytest/runner.py:168: in pytest_runtest_call
    item.runtest()
        item       = <Function test_async_with_session>
/usr/lib/python3.10/site-packages/_pytest/python.py:1718: in runtest
    self.ihook.pytest_pyfunc_call(pyfuncitem=self)
        self       = <Function test_async_with_session>
/usr/lib/python3.10/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
        argname    = 'pyfuncitem'
        args       = ()
        firstresult = True
        kwargs     = {'pyfuncitem': <Function test_async_with_session>}
        self       = <_HookCaller 'pytest_pyfunc_call'>
/usr/lib/python3.10/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
        firstresult = True
        hook_name  = 'pytest_pyfunc_call'
        kwargs     = {'pyfuncitem': <Function test_async_with_session>}
        methods    = [<HookImpl plugin_name='python', plugin=<module '_pytest.python' from '/usr/lib/python3.10/site-packages/_pytest/pytho...ddir/build/BUILDROOT/python-aiohttp-3.8.1-3.fc37.x86_64/usr/lib64/python3.10/site-packages/aiohttp/pytest_plugin.py'>>]
        self       = <_pytest.config.PytestPluginManager object at 0x7fe5b2d882b0>
../../BUILDROOT/python-aiohttp-3.8.1-3.fc37.x86_64/usr/lib64/python3.10/site-packages/aiohttp/pytest_plugin.py:186: in pytest_pyfunc_call
    _loop.run_until_complete(pyfuncitem.obj(**testargs))
        _loop      = <_UnixSelectorEventLoop running=False closed=False debug=False>
        existing_loop = None
        fast       = False
        pyfuncitem = <Function test_async_with_session>
        testargs   = {}
/usr/lib64/python3.10/asyncio/base_events.py:641: in run_until_complete
    return future.result()
        future     = <Task finished name='Task-1096' coro=<test_async_with_session() done, defined at /builddir/build/BUILD/aiohttp-3.8.1/t.../latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases.')>
        new_task   = True
        self       = <_UnixSelectorEventLoop running=False closed=False debug=False>
tests/test_client_functional.py:2431: in test_async_with_session
    with pytest.warns(None) as cm:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = WarningsChecker(record=True), expected_warning = None, match_expr = None

    def __init__(
        self,
        expected_warning: Optional[
            Union[Type[Warning], Tuple[Type[Warning], ...]]
        ] = Warning,
        match_expr: Optional[Union[str, Pattern[str]]] = None,
        *,
        _ispytest: bool = False,
    ) -> None:
        check_ispytest(_ispytest)
        super().__init__(_ispytest=True)
    
        msg = "exceptions must be derived from Warning, not %s"
        if expected_warning is None:
>           warnings.warn(WARNS_NONE_ARG, stacklevel=4)
E           pytest.PytestRemovedIn8Warning: Passing None has been deprecated.
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.

__class__  = <class '_pytest.recwarn.WarningsChecker'>
_ispytest  = True
expected_warning = None
match_expr = None
msg        = 'exceptions must be derived from Warning, not %s'
self       = WarningsChecker(record=True)

/usr/lib/python3.10/site-packages/_pytest/recwarn.py:246: PytestRemovedIn8Warning



This calls warns(None) and should not, see https://github.com/pytest-dev/pytest/issues/9002



There are several packages affected by this update, so I'd very much appreciate it if you could fix this failure. Please, check if your upstream hasn't already fixed it and backport the fix if possible. Report this failure to your upstream otherwise. If you need specific help, let me know.

Thanks!

Comment 1 Fedora Update System 2022-04-28 06:54:40 UTC
FEDORA-2022-4ad82087c8 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-4ad82087c8

Comment 2 Fedora Update System 2022-04-28 06:58:02 UTC
FEDORA-2022-4ad82087c8 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.