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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user