MCPcopy Create free account
hub / github.com/Delgan/loguru / test_enqueue_coroutine_loop

Function test_enqueue_coroutine_loop

tests/test_coroutine_sink.py:420–432  ·  view source on GitHub ↗
(capsys)

Source from the content-addressed store, hash-verified

418
419@pytest.mark.skipif(sys.version_info < (3, 5, 3), reason="Coroutine can't access running loop")
420def test_enqueue_coroutine_loop(capsys):
421 with new_event_loop_context() as loop:
422 logger.add(async_writer, enqueue=True, loop=loop, format="{message}", catch=False)
423
424 async def worker():
425 logger.info("A")
426 await logger.complete()
427
428 loop.run_until_complete(worker())
429
430 out, err = capsys.readouterr()
431 assert out == "A\n"
432 assert err == ""
433
434
435def test_enqueue_coroutine_from_inside_coroutine_without_loop(capsys):

Callers

nothing calls this directly

Calls 3

new_event_loop_contextFunction · 0.85
addMethod · 0.80
workerFunction · 0.70

Tested by

no test coverage detected