mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Collection of core tests improvements (#33757)
* Collection of core tests improvements * Added some more * Fix aiohttp client response release
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user