File tree Expand file tree Collapse file tree 3 files changed +18
-7
lines changed
Expand file tree Collapse file tree 3 files changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -1608,12 +1608,16 @@ def mock_integration(
16081608 top_level_files : set [str ] | None = None ,
16091609) -> loader .Integration :
16101610 """Mock an integration."""
1611- integration = loader .Integration (
1612- hass ,
1611+ path = (
16131612 f"{ loader .PACKAGE_BUILTIN } .{ module .DOMAIN } "
16141613 if built_in
1615- else f"{ loader .PACKAGE_CUSTOM_COMPONENTS } .{ module .DOMAIN } " ,
1616- pathlib .Path ("" ),
1614+ else f"{ loader .PACKAGE_CUSTOM_COMPONENTS } .{ module .DOMAIN } "
1615+ )
1616+
1617+ integration = loader .Integration (
1618+ hass ,
1619+ path ,
1620+ pathlib .Path (path .replace ("." , "/" )),
16171621 module .mock_manifest (),
16181622 top_level_files ,
16191623 )
Original file line number Diff line number Diff line change @@ -1029,7 +1029,9 @@ def load_yaml(fname, secrets=None):
10291029 ):
10301030 descriptions = await service .async_get_all_descriptions (hass )
10311031
1032- mock_load_yaml .assert_called_once_with ("services.yaml" , None )
1032+ mock_load_yaml .assert_called_once_with (
1033+ "homeassistant/components/test_domain/services.yaml" , None
1034+ )
10331035 assert proxy_load_services_files .mock_calls [0 ][1 ][0 ] == unordered (
10341036 [
10351037 await async_get_integration (hass , domain ),
@@ -1117,7 +1119,9 @@ def load_yaml(fname, secrets=None):
11171119 ):
11181120 descriptions = await service .async_get_all_descriptions (hass )
11191121
1120- mock_load_yaml .assert_called_once_with ("services.yaml" , None )
1122+ mock_load_yaml .assert_called_once_with (
1123+ "homeassistant/components/test_domain/services.yaml" , None
1124+ )
11211125 assert proxy_load_services_files .mock_calls [0 ][1 ][0 ] == unordered (
11221126 [
11231127 await async_get_integration (hass , domain ),
Original file line number Diff line number Diff line change @@ -84,7 +84,10 @@ async def test_evict_faked_translations_assumptions(hass: HomeAssistant) -> None
8484 If this test fails, the evict_faked_translations may need to be updated.
8585 """
8686 integration = mock_integration (hass , MockModule ("test" ), built_in = True )
87- assert integration .file_path == pathlib .Path ("" )
87+ assert integration .file_path == pathlib .Path ("homeassistant/components/test" )
88+
89+ integration = mock_integration (hass , MockModule ("test" ), built_in = False )
90+ assert integration .file_path == pathlib .Path ("custom_components/test" )
8891
8992
9093async def test_evict_faked_translations (hass : HomeAssistant , translations_once ) -> None :
You can’t perform that action at this time.
0 commit comments