From 71b123845cc03645fecd5a030b54afc5b8c4d452 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Wed, 18 Aug 2021 22:17:16 -0700 Subject: [PATCH] Always mock SubscriptionRegistry & DiscoveryResponder for wemo tests (#53967) * Always mock SubscriptionRegistry & DiscoveryResponder for wemo tests * Use autospec=True for patch --- tests/components/wemo/conftest.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/components/wemo/conftest.py b/tests/components/wemo/conftest.py index 7766fe512cc..bf69318706c 100644 --- a/tests/components/wemo/conftest.py +++ b/tests/components/wemo/conftest.py @@ -22,8 +22,8 @@ def pywemo_model_fixture(): return "LightSwitch" -@pytest.fixture(name="pywemo_registry") -def pywemo_registry_fixture(): +@pytest.fixture(name="pywemo_registry", autouse=True) +async def async_pywemo_registry_fixture(): """Fixture for SubscriptionRegistry instances.""" registry = create_autospec(pywemo.SubscriptionRegistry, instance=True) @@ -40,6 +40,13 @@ def pywemo_registry_fixture(): yield registry +@pytest.fixture(name="pywemo_discovery_responder", autouse=True) +def pywemo_discovery_responder_fixture(): + """Fixture for the DiscoveryResponder instance.""" + with patch("pywemo.ssdp.DiscoveryResponder", autospec=True): + yield + + @pytest.fixture(name="pywemo_device") def pywemo_device_fixture(pywemo_registry, pywemo_model): """Fixture for WeMoDevice instances."""