From 0ee86ea8e4a1b91b0c3b0604d7d9e824efcf8472 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 1 Dec 2020 19:26:43 +0100 Subject: [PATCH] Another try to get rid of Shelly flaky test (#43821) --- tests/components/shelly/conftest.py | 11 +++++++++++ tests/components/shelly/test_config_flow.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 tests/components/shelly/conftest.py diff --git a/tests/components/shelly/conftest.py b/tests/components/shelly/conftest.py new file mode 100644 index 00000000000..3f97c0ef317 --- /dev/null +++ b/tests/components/shelly/conftest.py @@ -0,0 +1,11 @@ +"""Test configuration for Shelly.""" +import pytest + +from tests.async_mock import patch + + +@pytest.fixture(autouse=True) +def mock_coap(): + """Mock out coap.""" + with patch("homeassistant.components.shelly.get_coap_context"): + yield diff --git a/tests/components/shelly/test_config_flow.py b/tests/components/shelly/test_config_flow.py index bef018e7d91..1796847bd74 100644 --- a/tests/components/shelly/test_config_flow.py +++ b/tests/components/shelly/test_config_flow.py @@ -36,7 +36,7 @@ async def test_form(hass): assert result["type"] == "form" assert result["errors"] == {} - with patch("aioshelly.COAP", return_value=Mock(initialize=AsyncMock())), patch( + with patch( "aioshelly.get_info", return_value={"mac": "test-mac", "type": "SHSW-1", "auth": False}, ), patch(