Skip to content

Commit 34cd9f1

Browse files
authored
Fix onkyo tests opening sockets (home-assistant#156461)
1 parent 0711d62 commit 34cd9f1

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

tests/components/onkyo/test_config_flow.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ def _receiver_display_name(receiver_info: ReceiverInfo) -> str:
3232
return f"{receiver_info.model_name} ({receiver_info.host})"
3333

3434

35-
@pytest.mark.usefixtures("mock_setup_entry")
35+
@pytest.fixture(autouse=True)
36+
def mock_setup_entry(mock_setup_entry) -> None:
37+
"""Use async_setup_entry fixture in all tests."""
38+
39+
3640
async def test_manual(hass: HomeAssistant) -> None:
3741
"""Test successful manual."""
3842
result = await hass.config_entries.flow.async_init(
@@ -79,7 +83,6 @@ async def test_manual(hass: HomeAssistant) -> None:
7983
(mock_discovery([RECEIVER_INFO]), "cannot_connect"),
8084
],
8185
)
82-
@pytest.mark.usefixtures("mock_setup_entry")
8386
async def test_manual_recoverable_error(
8487
hass: HomeAssistant, mock_discovery: AbstractContextManager, error_reason: str
8588
) -> None:
@@ -129,7 +132,6 @@ async def test_manual_recoverable_error(
129132
assert result["title"] == RECEIVER_INFO_2.model_name
130133

131134

132-
@pytest.mark.usefixtures("mock_setup_entry")
133135
async def test_manual_error(
134136
hass: HomeAssistant, mock_config_entry: MockConfigEntry
135137
) -> None:
@@ -158,7 +160,6 @@ async def test_manual_error(
158160
assert result["reason"] == "already_configured"
159161

160162

161-
@pytest.mark.usefixtures("mock_setup_entry")
162163
async def test_eiscp_discovery(
163164
hass: HomeAssistant, mock_config_entry: MockConfigEntry
164165
) -> None:
@@ -214,7 +215,6 @@ async def test_eiscp_discovery(
214215
(mock_discovery([RECEIVER_INFO]), "no_devices_found"),
215216
],
216217
)
217-
@pytest.mark.usefixtures("mock_setup_entry")
218218
async def test_eiscp_discovery_error(
219219
hass: HomeAssistant,
220220
mock_config_entry: MockConfigEntry,
@@ -291,7 +291,6 @@ async def test_eiscp_discovery_replace_ignored_entry(
291291
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
292292

293293

294-
@pytest.mark.usefixtures("mock_setup_entry")
295294
async def test_ssdp_discovery(
296295
hass: HomeAssistant, mock_config_entry: MockConfigEntry
297296
) -> None:
@@ -343,7 +342,6 @@ async def test_ssdp_discovery(
343342
(f"http://{RECEIVER_INFO.host}:8080", nullcontext(), "already_configured"),
344343
],
345344
)
346-
@pytest.mark.usefixtures("mock_setup_entry")
347345
async def test_ssdp_discovery_error(
348346
hass: HomeAssistant,
349347
mock_config_entry: MockConfigEntry,
@@ -371,7 +369,6 @@ async def test_ssdp_discovery_error(
371369
assert result["reason"] == error_reason
372370

373371

374-
@pytest.mark.usefixtures("mock_setup_entry")
375372
async def test_configure(hass: HomeAssistant) -> None:
376373
"""Test receiver configure."""
377374
result = await hass.config_entries.flow.async_init(
@@ -442,7 +439,6 @@ async def test_configure(hass: HomeAssistant) -> None:
442439
}
443440

444441

445-
@pytest.mark.usefixtures("mock_setup_entry")
446442
async def test_reconfigure(
447443
hass: HomeAssistant, mock_config_entry: MockConfigEntry
448444
) -> None:
@@ -479,7 +475,6 @@ async def test_reconfigure(
479475
assert mock_config_entry.options[option] == option_value
480476

481477

482-
@pytest.mark.usefixtures("mock_setup_entry")
483478
async def test_reconfigure_error(
484479
hass: HomeAssistant, mock_config_entry: MockConfigEntry
485480
) -> None:
@@ -504,7 +499,6 @@ async def test_reconfigure_error(
504499
assert mock_config_entry.unique_id == old_unique_id
505500

506501

507-
@pytest.mark.usefixtures("mock_setup_entry")
508502
@pytest.mark.parametrize(
509503
"ignore_missing_translations",
510504
[

0 commit comments

Comments
 (0)