1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-22 20:09:35 +00:00

Merge multiple context managers in tests (#48146)

This commit is contained in:
Franck Nijhof
2021-03-27 09:17:15 +01:00
committed by GitHub
parent 79af18a8ab
commit ad13a9295e
33 changed files with 590 additions and 627 deletions

View File

@@ -291,20 +291,19 @@ async def async_log_error_from_test_path(hass, path, sq):
call_path = "internal_path.py"
with patch.object(
_LOGGER, "findCaller", MagicMock(return_value=(call_path, 0, None, None))
), patch(
"traceback.extract_stack",
MagicMock(
return_value=[
get_frame("main_path/main.py"),
get_frame(path),
get_frame(call_path),
get_frame("venv_path/logging/log.py"),
]
),
):
with patch(
"traceback.extract_stack",
MagicMock(
return_value=[
get_frame("main_path/main.py"),
get_frame(path),
get_frame(call_path),
get_frame("venv_path/logging/log.py"),
]
),
):
_LOGGER.error("error message")
await _async_block_until_queue_empty(hass, sq)
_LOGGER.error("error message")
await _async_block_until_queue_empty(hass, sq)
async def test_homeassistant_path(hass, simple_queue, hass_client):