Collection of core tests improvements (#33757)

* Collection of core tests improvements

* Added some more

* Fix aiohttp client response release
This commit is contained in:
Franck Nijhof
2020-04-07 18:33:23 +02:00
committed by GitHub
parent 1f7803c541
commit 60bc517d01
12 changed files with 302 additions and 343 deletions

View File

@@ -19,8 +19,7 @@ def test_sensitive_data_filter():
assert sensitive_record.msg == "******* log"
@asyncio.coroutine
def test_async_handler_loop_log(loop):
async def test_async_handler_loop_log(loop):
"""Test logging data inside from inside the event loop."""
loop._thread_ident = threading.get_ident()
@@ -39,13 +38,12 @@ def test_async_handler_loop_log(loop):
log_record = logging.makeLogRecord({"msg": "Test Log Record"})
handler.emit(log_record)
yield from handler.async_close(True)
await handler.async_close(True)
assert queue.get_nowait().msg == "Test Log Record"
assert queue.empty()
@asyncio.coroutine
def test_async_handler_thread_log(loop):
async def test_async_handler_thread_log(loop):
"""Test logging data from a thread."""
loop._thread_ident = threading.get_ident()
@@ -60,8 +58,8 @@ def test_async_handler_thread_log(loop):
handler.emit(log_record)
handler.close()
yield from loop.run_in_executor(None, add_log)
yield from handler.async_close(True)
await loop.run_in_executor(None, add_log)
await handler.async_close(True)
assert queue.get_nowait().msg == "Test Log Record"
assert queue.empty()