diff --git a/tests/components/imou/test_camera.py b/tests/components/imou/test_camera.py index c269aab3fea4..f5bb225bf3bd 100644 --- a/tests/components/imou/test_camera.py +++ b/tests/components/imou/test_camera.py @@ -93,11 +93,13 @@ async def test_camera_entities_snapshot( @pytest.mark.usefixtures("init_integration") async def test_no_camera_without_channel( hass: HomeAssistant, + entity_registry: er.EntityRegistry, mock_config_entry: MockConfigEntry, ) -> None: """Devices without a channel do not get a camera entity.""" - registry = er.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures - entries = er.async_entries_for_config_entry(registry, mock_config_entry.entry_id) + entries = er.async_entries_for_config_entry( + entity_registry, mock_config_entry.entry_id + ) assert not any(entry.domain == "camera" for entry in entries) diff --git a/tests/components/imou/test_init.py b/tests/components/imou/test_init.py index 2f8027af5a8e..f653971c621c 100644 --- a/tests/components/imou/test_init.py +++ b/tests/components/imou/test_init.py @@ -63,11 +63,13 @@ async def test_setup_entry_failed_on_refresh( @pytest.mark.usefixtures("init_integration") async def test_device_registry_identifiers( hass: HomeAssistant, + device_registry: dr.DeviceRegistry, mock_config_entry: MockConfigEntry, ) -> None: """Device registry uses channel-aware identifiers from the default mock devices.""" - registry = dr.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures - devices = dr.async_entries_for_config_entry(registry, mock_config_entry.entry_id) + devices = dr.async_entries_for_config_entry( + device_registry, mock_config_entry.entry_id + ) assert len(devices) == 1 assert (DOMAIN, "d1") in devices[0].identifiers diff --git a/tests/components/imou/test_switch.py b/tests/components/imou/test_switch.py index fa6c5fc83a21..0d10e6c80664 100644 --- a/tests/components/imou/test_switch.py +++ b/tests/components/imou/test_switch.py @@ -78,11 +78,13 @@ async def test_switch_entities_snapshot( @pytest.mark.usefixtures("init_integration") async def test_setup_ignores_unknown_switch_types( hass: HomeAssistant, + entity_registry: er.EntityRegistry, mock_config_entry: MockConfigEntry, ) -> None: """Unknown switch keys from the API are not turned into entities.""" - registry = er.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures - entries = er.async_entries_for_config_entry(registry, mock_config_entry.entry_id) + entries = er.async_entries_for_config_entry( + entity_registry, mock_config_entry.entry_id + ) switch_entries = [entry for entry in entries if entry.domain == SWITCH_DOMAIN] assert len(switch_entries) == 1 assert switch_entries[0].translation_key == PARAM_MOTION_DETECT diff --git a/tests/components/integration/test_init.py b/tests/components/integration/test_init.py index 8328c82bf4a8..1a33a219dc53 100644 --- a/tests/components/integration/test_init.py +++ b/tests/components/integration/test_init.py @@ -148,12 +148,14 @@ async def test_setup_and_remove_config_entry( @pytest.mark.parametrize("platform", ["sensor"]) -async def test_entry_changed(hass: HomeAssistant, platform) -> None: +async def test_entry_changed( + hass: HomeAssistant, + device_registry: dr.DeviceRegistry, + entity_registry: er.EntityRegistry, + platform, +) -> None: """Test reconfiguring.""" - device_registry = dr.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures - entity_registry = er.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures - def _create_mock_entity(domain: str, name: str) -> er.RegistryEntry: config_entry = MockConfigEntry( data={}, diff --git a/tests/components/intent/test_temperature.py b/tests/components/intent/test_temperature.py index 20513e29ef2e..fa6d5db64498 100644 --- a/tests/components/intent/test_temperature.py +++ b/tests/components/intent/test_temperature.py @@ -183,7 +183,6 @@ async def test_get_temperature( # first floor => living room and office # 2nd floor => bedroom # 3rd floor => attic - floor_registry = fr.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures first_floor = floor_registry.async_create("First floor") living_room_area = area_registry.async_update( living_room_area.id, floor_id=first_floor.floor_id diff --git a/tests/components/iss/test_sensor.py b/tests/components/iss/test_sensor.py index c03be24e4d8e..00bf64704311 100644 --- a/tests/components/iss/test_sensor.py +++ b/tests/components/iss/test_sensor.py @@ -56,16 +56,17 @@ async def test_sensor_attributes_show_on_map_true( async def test_sensor_device_info( - hass: HomeAssistant, init_integration: MockConfigEntry + hass: HomeAssistant, + device_registry: dr.DeviceRegistry, + entity_registry: er.EntityRegistry, + init_integration: MockConfigEntry, ) -> None: """Test sensor has correct device info.""" - entity_registry = er.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures entity = entity_registry.async_get("sensor.iss") assert entity is not None assert entity.unique_id == f"{init_integration.entry_id}_people" - device_registry = dr.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures device = device_registry.async_get(entity.device_id) assert device is not None diff --git a/tests/components/knx/test_repairs.py b/tests/components/knx/test_repairs.py index 527ea4ae2225..a375efcc5456 100644 --- a/tests/components/knx/test_repairs.py +++ b/tests/components/knx/test_repairs.py @@ -38,6 +38,7 @@ async def test_create_fix_flow_raises_on_unknown_issue_id(hass: HomeAssistant) - async def test_data_secure_group_key_issue_only_for_configured_group_address( hass: HomeAssistant, knx: KNXTestKit, + issue_registry: ir.IssueRegistry, configured_group_address: str, ) -> None: """Test that repair issue is only created for configured group addresses.""" @@ -50,7 +51,6 @@ async def test_data_secure_group_key_issue_only_for_configured_group_address( } ) - issue_registry = ir.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures assert bool(issue_registry.issues) is False # An issue should only be created if this address is configured. knx.receive_data_secure_issue("1/2/5") @@ -62,6 +62,7 @@ async def test_data_secure_group_key_issue_repair_flow( hass_client: ClientSessionGenerator, hass_ws_client: WebSocketGenerator, knx: KNXTestKit, + issue_registry: ir.IssueRegistry, ) -> None: """Test repair flow for DataSecure group key issue.""" await knx.setup_integration( @@ -76,7 +77,6 @@ async def test_data_secure_group_key_issue_repair_flow( knx.receive_data_secure_issue("11/0/0", source="1.0.1") knx.receive_data_secure_issue("1/2/5", source="1.0.10") knx.receive_data_secure_issue("1/2/5", source="1.0.1") - issue_registry = ir.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures issue = issue_registry.async_get_issue(DOMAIN, REPAIR_ISSUE_DATA_SECURE_GROUP_KEY) assert issue is not None assert issue.translation_placeholders == { diff --git a/tests/components/knx/test_telegrams.py b/tests/components/knx/test_telegrams.py index c600c887a0c1..9f985accabeb 100644 --- a/tests/components/knx/test_telegrams.py +++ b/tests/components/knx/test_telegrams.py @@ -149,6 +149,7 @@ async def test_store_telegram_history_sqlite( async def test_store_telegram_history_error_handling( hass: HomeAssistant, knx: KNXTestKit, + issue_registry: ir.IssueRegistry, side_effect: Exception, ) -> None: """Test storage initialization handling for the different failure modes.""" @@ -162,7 +163,6 @@ async def test_store_telegram_history_error_handling( assert telegrams_module.store is None # Check that the repair issue was created - issue_registry = ir.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures issue = issue_registry.async_get_issue(DOMAIN, REPAIR_ISSUE_TELEGRAM_BACKEND_ERROR) assert issue is not None @@ -170,6 +170,7 @@ async def test_store_telegram_history_error_handling( async def test_store_telegram_history_needs_migration_timeout( hass: HomeAssistant, knx: KNXTestKit, + issue_registry: ir.IssueRegistry, ) -> None: """Test store init aborts when needs_migration times out and retries are off.""" @@ -191,7 +192,6 @@ async def test_store_telegram_history_needs_migration_timeout( assert telegrams_module.store is None # Check that the repair issue was created - issue_registry = ir.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures issue = issue_registry.async_get_issue(DOMAIN, REPAIR_ISSUE_TELEGRAM_BACKEND_ERROR) assert issue is not None @@ -695,6 +695,7 @@ async def test_nightly_eviction_error_handling( async def test_postgres_backend_init_error( hass: HomeAssistant, knx: KNXTestKit, + issue_registry: ir.IssueRegistry, ) -> None: """Test PostgreSQL backend DSN handling and init failure path.""" dsn = "postgresql://user:secret@db.local:5432/knx" @@ -721,7 +722,6 @@ async def test_postgres_backend_init_error( telegrams_module = hass.data[KNX_MODULE_KEY].telegrams assert telegrams_module.store is None - issue_registry = ir.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures assert ( issue_registry.async_get_issue(DOMAIN, REPAIR_ISSUE_TELEGRAM_BACKEND_ERROR) is not None diff --git a/tests/components/kulersky/test_init.py b/tests/components/kulersky/test_init.py index b19081dfe84a..24ce8485e3e8 100644 --- a/tests/components/kulersky/test_init.py +++ b/tests/components/kulersky/test_init.py @@ -11,6 +11,7 @@ from tests.common import MockConfigEntry async def test_migrate_entry( hass: HomeAssistant, + device_registry: dr.DeviceRegistry, ) -> None: """Test migrate config entry from v1 to v2.""" @@ -22,14 +23,13 @@ async def test_migrate_entry( mock_config_entry_v1.add_to_hass(hass) - dev_reg = dr.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures # Create device registry entries for old integration - dev_reg.async_get_or_create( + device_registry.async_get_or_create( config_entry_id=mock_config_entry_v1.entry_id, identifiers={(DOMAIN, "AA:BB:CC:11:22:33")}, name="KuLight 1", ) - dev_reg.async_get_or_create( + device_registry.async_get_or_create( config_entry_id=mock_config_entry_v1.entry_id, identifiers={(DOMAIN, "AA:BB:CC:44:55:66")}, name="KuLight 2", diff --git a/tests/components/lamarzocco/test_init.py b/tests/components/lamarzocco/test_init.py index 93e670f812bb..b8d474fe0b04 100644 --- a/tests/components/lamarzocco/test_init.py +++ b/tests/components/lamarzocco/test_init.py @@ -220,6 +220,7 @@ async def test_websocket_closed_on_unload( ) async def test_gateway_version_issue( hass: HomeAssistant, + issue_registry: ir.IssueRegistry, mock_config_entry: MockConfigEntry, mock_cloud_client: MagicMock, version: str, @@ -232,7 +233,6 @@ async def test_gateway_version_issue( await async_init_integration(hass, mock_config_entry) - issue_registry = ir.async_get(hass) # pylint: disable=home-assistant-tests-registry-fixtures issue = issue_registry.async_get_issue(DOMAIN, "unsupported_gateway_firmware") assert (issue is not None) == issue_exists