gapic-generator-python icon indicating copy to clipboard operation
gapic-generator-python copied to clipboard

DeprecationWarning: pytest-asyncio detected an unclosed event loop when tearing down the event_loop

Open parthea opened this issue 2 years ago • 0 comments

The warning below appears when running showcase tests. See build log here:

__________ ERROR at teardown of test_async_stream_stream_passing_dict __________

    def _close_event_loop() -> None:
        policy = asyncio.get_event_loop_policy()
        try:
            loop = policy.get_event_loop()
        except RuntimeError:
            loop = None
        if loop is not None:
            if not loop.is_closed():
>               warnings.warn(
                    _UNCLOSED_EVENT_LOOP_WARNING % loop,
                    DeprecationWarning,
                )
E               DeprecationWarning: pytest-asyncio detected an unclosed event loop when tearing down the event_loop
E               fixture: <_UnixSelectorEventLoop running=False closed=False debug=False>
E               pytest-asyncio will close the event loop for you, but future versions of the
E               library will no longer do so. In order to ensure compatibility with future
E               versions, please make sure that:
E                   1. Any custom "event_loop" fixture properly closes the loop after yielding it
E                   2. The scopes of your custom "event_loop" fixtures do not overlap
E                   3. Your code does not modify the event loop in async fixtures or tests

.nox/showcase-3-12/lib/python3.12/site-packages/pytest_asyncio/plugin.py:451: DeprecationWarning

parthea avatar Nov 28 '23 17:11 parthea