Skip to content

Commit a4405e7

Browse files
authored
[create-pull-request] automated change (#62)
Co-authored-by: MatthewFlamm <[email protected]>
1 parent 4ca5b64 commit a4405e7

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pytest-homeassistant-custom-component
22

3-
![HA core version](https://img.shields.io/static/v1?label=HA+core+version&message=2021.4.4&labelColor=blue)
3+
![HA core version](https://img.shields.io/static/v1?label=HA+core+version&message=2021.5.0b4&labelColor=blue)
44

55
Package to automatically extract testing plugins from Home Assistant for custom component testing.
66
The goal is to provide the same functionality as the tests in home-assistant/core.

pytest_homeassistant_custom_component/common.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ def __init__(
740740
connection_class=config_entries.CONN_CLASS_UNKNOWN,
741741
unique_id=None,
742742
disabled_by=None,
743+
reason=None,
743744
):
744745
"""Initialize a mock config entry."""
745746
kwargs = {
@@ -759,6 +760,8 @@ def __init__(
759760
if state is not None:
760761
kwargs["state"] = state
761762
super().__init__(**kwargs)
763+
if reason is not None:
764+
self.reason = reason
762765

763766
def add_to_hass(self, hass):
764767
"""Test helper to add entry to hass."""
@@ -1052,10 +1055,15 @@ async def get_system_health_info(hass, domain):
10521055
return await hass.data["system_health"][domain].info_callback(hass)
10531056

10541057

1055-
def mock_integration(hass, module):
1058+
def mock_integration(hass, module, built_in=True):
10561059
"""Mock an integration."""
10571060
integration = loader.Integration(
1058-
hass, f"homeassistant.components.{module.DOMAIN}", None, module.mock_manifest()
1061+
hass,
1062+
f"{loader.PACKAGE_BUILTIN}.{module.DOMAIN}"
1063+
if built_in
1064+
else f"{loader.PACKAGE_CUSTOM_COMPONENTS}.{module.DOMAIN}",
1065+
None,
1066+
module.mock_manifest(),
10591067
)
10601068

10611069
def mock_import_platform(platform_name):

pytest_homeassistant_custom_component/const.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
This file is originally from homeassistant/core and modified by pytest-homeassistant-custom-component.
55
"""
66
MAJOR_VERSION = 2021
7-
MINOR_VERSION = 4
8-
PATCH_VERSION = "4"
7+
MINOR_VERSION = 5
8+
PATCH_VERSION = "0b4"
99
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
1010
__version__ = f"{__short_version__}.{PATCH_VERSION}"

pytest_homeassistant_custom_component/test_util/aiohttp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ async def close_session(event):
292292
return session
293293

294294
with mock.patch(
295-
"homeassistant.helpers.aiohttp_client.async_create_clientsession",
295+
"homeassistant.helpers.aiohttp_client._async_create_clientsession",
296296
side_effect=create_session,
297297
):
298298
yield mocker

requirements_dev.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is originally from homeassistant/core and modified by pytest-homeassistant-custom-component.
22
codecov==2.1.10
33
mypy==0.812
4-
pre-commit==2.11.1
5-
pylint==2.7.4
6-
astroid==2.5.2
4+
pre-commit==2.12.1
5+
pylint==2.8.0
6+
astroid==2.5.5

requirements_test.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ pytest-test-groups==1.0.3
1616
pytest-sugar==0.9.4
1717
pytest-timeout==1.4.2
1818
pytest-xdist==2.1.0
19-
pytest==6.2.2
19+
pytest==6.2.3
2020
requests_mock==1.8.0
2121
responses==0.12.0
22-
respx==0.16.2
22+
respx==0.17.0
2323
stdlib-list==0.7.0
2424
tqdm==4.49.0
25-
homeassistant==2021.4.4
25+
homeassistant==2021.5.0b4

0 commit comments

Comments
 (0)