Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test_contextlib_async produces severalRuntimeWarnings #110378

Closed
Assignees
serhiy-storchakasobolevn
Labels
testsTests in the Lib/test dirtopic-asynciotype-bugAn unexpected behavior, bug, or error
@sobolevn

Description

@sobolevn

Bug report

» ./python.exe -m test test_contextlib_asyncUsing random seed 9082919800:00:00 load avg: 4.08 Run 1 test sequentially0:00:00 load avg: 4.08 [1/1] test_contextlib_async/Users/sobolev/Desktop/cpython/Lib/contextlib.py:701: RuntimeWarning: coroutine method 'aclose' of 'AsyncContextManagerTestCase.test_contextmanager_trap_second_yield.<locals>.whoo' was never awaited  async def __aenter__(self):RuntimeWarning: Enable tracemalloc to get the object allocation traceback/Users/sobolev/Desktop/cpython/Lib/contextlib.py:701: RuntimeWarning: coroutine method 'aclose' of 'AsyncContextManagerTestCase.test_contextmanager_trap_yield_after_throw.<locals>.whoo' was never awaited  async def __aenter__(self):RuntimeWarning: Enable tracemalloc to get the object allocation traceback/Users/sobolev/Desktop/cpython/Lib/contextlib.py:701: RuntimeWarning: coroutine method 'aclose' of 'TestAbstractAsyncContextManager.test_async_gen_propagates_generator_exit.<locals>.gen' was never awaited  async def __aenter__(self):RuntimeWarning: Enable tracemalloc to get the object allocation traceback== Tests result: SUCCESS ==1 test OK.Total duration: 121 msTotal tests: run=58Total test files: run=1/1Result: SUCCESS

This can be fixed by moving away from legacy@_async_test and by using stabelIsolatedAsyncioTestCase.

def_async_test(func):
"""Decorator to turn an async function into a test case."""
@functools.wraps(func)
defwrapper(*args,**kwargs):
coro=func(*args,**kwargs)
asyncio.run(coro)
returnwrapper

Linked PRs

Metadata

Metadata

Labels

testsTests in the Lib/test dirtopic-asynciotype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp