From 8137b0bb9e337e9735c810b3c0f31d3e1ce9ae03 Mon Sep 17 00:00:00 2001 From: Jason Hu Date: Sat, 9 Feb 2019 13:13:12 -0800 Subject: [PATCH] Fix coroutine never awaited warning in test (#20892) --- tests/test_core.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index f1900979bec..3cb5b87b4bb 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -58,9 +58,9 @@ def test_async_add_job_schedule_partial_callback(): assert len(hass.add_job.mock_calls) == 0 -def test_async_add_job_schedule_coroutinefunction(): +def test_async_add_job_schedule_coroutinefunction(loop): """Test that we schedule coroutines and add jobs to the job pool.""" - hass = MagicMock() + hass = MagicMock(loop=MagicMock(wraps=loop)) async def job(): pass @@ -71,9 +71,9 @@ def test_async_add_job_schedule_coroutinefunction(): assert len(hass.add_job.mock_calls) == 0 -def test_async_add_job_schedule_partial_coroutinefunction(): +def test_async_add_job_schedule_partial_coroutinefunction(loop): """Test that we schedule partial coros and add jobs to the job pool.""" - hass = MagicMock() + hass = MagicMock(loop=MagicMock(wraps=loop)) async def job(): pass @@ -98,9 +98,9 @@ def test_async_add_job_add_threaded_job_to_pool(): assert len(hass.loop.run_in_executor.mock_calls) == 1 -def test_async_create_task_schedule_coroutine(): +def test_async_create_task_schedule_coroutine(loop): """Test that we schedule coroutines and add jobs to the job pool.""" - hass = MagicMock() + hass = MagicMock(loop=MagicMock(wraps=loop)) async def job(): pass