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

@@ -206,8 +206,9 @@ async def test_callback_is_always_scheduled(hass):
callback = MagicMock()
hasync.shutdown_run_callback_threadsafe(hass.loop)
with patch.object(hass.loop, "call_soon_threadsafe") as mock_call_soon_threadsafe:
with pytest.raises(RuntimeError):
hasync.run_callback_threadsafe(hass.loop, callback)
with patch.object(
hass.loop, "call_soon_threadsafe"
) as mock_call_soon_threadsafe, pytest.raises(RuntimeError):
hasync.run_callback_threadsafe(hass.loop, callback)
mock_call_soon_threadsafe.assert_called_once()