Skip to content

Commit c10e046

Browse files
authored
Merge pull request #28399 from home-assistant/rc
0.101.1
2 parents 2d72084 + 633d006 commit c10e046

File tree

13 files changed

+70
-37
lines changed

13 files changed

+70
-37
lines changed

homeassistant/components/airly/__init__.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
"""The Airly component."""
22
import asyncio
3-
import logging
43
from datetime import timedelta
4+
import logging
55

6-
import async_timeout
76
from aiohttp.client_exceptions import ClientConnectorError
87
from airly import Airly
98
from airly.exceptions import AirlyError
9+
import async_timeout
1010

1111
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE
1212
from homeassistant.core import Config, HomeAssistant
13+
from homeassistant.exceptions import ConfigEntryNotReady
1314
from homeassistant.helpers.aiohttp_client import async_get_clientsession
1415
from homeassistant.util import Throttle
1516

@@ -45,6 +46,9 @@ async def async_setup_entry(hass, config_entry):
4546

4647
await airly.async_update()
4748

49+
if not airly.data:
50+
raise ConfigEntryNotReady()
51+
4852
hass.data[DOMAIN] = {}
4953
hass.data[DOMAIN][DATA_CLIENT] = {}
5054
hass.data[DOMAIN][DATA_CLIENT][config_entry.entry_id] = airly
@@ -81,7 +85,7 @@ async def async_update(self):
8185
"""Update Airly data."""
8286

8387
try:
84-
with async_timeout.timeout(10):
88+
with async_timeout.timeout(20):
8589
measurements = self.airly.create_measurements_session_point(
8690
self.latitude, self.longitude
8791
)
@@ -104,11 +108,8 @@ async def async_update(self):
104108
self.data[ATTR_API_CAQI_DESCRIPTION] = index["description"]
105109
self.data[ATTR_API_ADVICE] = index["advice"]
106110
_LOGGER.debug("Data retrieved from Airly")
107-
except (
108-
ValueError,
109-
AirlyError,
110-
asyncio.TimeoutError,
111-
ClientConnectorError,
112-
) as error:
111+
except asyncio.TimeoutError:
112+
_LOGGER.error("Asyncio Timeout Error")
113+
except (ValueError, AirlyError, ClientConnectorError) as error:
113114
_LOGGER.error(error)
114115
self.data = {}

homeassistant/components/environment_canada/manifest.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
"domain": "environment_canada",
33
"name": "Environment Canada",
44
"documentation": "https://www.home-assistant.io/integrations/environment_canada",
5-
"requirements": [
6-
"env_canada==0.0.27"
7-
],
5+
"requirements": ["env_canada==0.0.29"],
86
"dependencies": [],
9-
"codeowners": [
10-
"@michaeldavie"
11-
]
7+
"codeowners": ["@michaeldavie"]
128
}

homeassistant/components/jewish_calendar/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Jewish calendar",
44
"documentation": "https://www.home-assistant.io/integrations/jewish_calendar",
55
"requirements": [
6-
"hdate==0.9.1"
6+
"hdate==0.9.3"
77
],
88
"dependencies": [],
99
"codeowners": [

homeassistant/components/myq/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Myq",
44
"documentation": "https://www.home-assistant.io/integrations/myq",
55
"requirements": [
6-
"pymyq==2.0.0"
6+
"pymyq==2.0.1"
77
],
88
"dependencies": [],
99
"codeowners": []

homeassistant/components/saj/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "SAJ",
44
"documentation": "https://www.home-assistant.io/integrations/saj",
55
"requirements": [
6-
"pysaj==0.0.12"
6+
"pysaj==0.0.13"
77
],
88
"dependencies": [],
99
"codeowners": [

homeassistant/components/songpal/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Songpal",
44
"documentation": "https://www.home-assistant.io/integrations/songpal",
55
"requirements": [
6-
"python-songpal==0.11.1"
6+
"python-songpal==0.11.2"
77
],
88
"dependencies": [],
99
"codeowners": [

homeassistant/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Constants used by Home Assistant components."""
22
MAJOR_VERSION = 0
33
MINOR_VERSION = 101
4-
PATCH_VERSION = "0"
4+
PATCH_VERSION = "1"
55
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
66
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
77
REQUIRED_PYTHON_VER = (3, 6, 1)

homeassistant/requirements.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,21 @@ async def async_get_integration_with_requirements(
3535
This can raise IntegrationNotFound if manifest or integration
3636
is invalid, RequirementNotFound if there was some type of
3737
failure to install requirements.
38+
39+
Does not handle circular dependencies.
3840
"""
3941
integration = await async_get_integration(hass, domain)
4042

41-
if hass.config.skip_pip or not integration.requirements:
43+
if hass.config.skip_pip:
4244
return integration
4345

44-
await async_process_requirements(hass, integration.domain, integration.requirements)
46+
if integration.requirements:
47+
await async_process_requirements(
48+
hass, integration.domain, integration.requirements
49+
)
50+
51+
for dependency in integration.dependencies:
52+
await async_get_integration_with_requirements(hass, dependency)
4553

4654
return integration
4755

homeassistant/setup.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,17 @@ def log_error(msg: str, link: bool = True) -> None:
132132
log_error(str(err))
133133
return False
134134

135+
# Some integrations fail on import because they call functions incorrectly.
136+
# So we do it before validating config to catch these errors.
137+
try:
138+
component = integration.get_component()
139+
except ImportError:
140+
log_error("Unable to import component", False)
141+
return False
142+
except Exception: # pylint: disable=broad-except
143+
_LOGGER.exception("Setup failed for %s: unknown error", domain)
144+
return False
145+
135146
processed_config = await conf_util.async_process_component_config(
136147
hass, config, integration
137148
)
@@ -143,12 +154,6 @@ def log_error(msg: str, link: bool = True) -> None:
143154
start = timer()
144155
_LOGGER.info("Setting up %s", domain)
145156

146-
try:
147-
component = integration.get_component()
148-
except ImportError:
149-
log_error("Unable to import component", False)
150-
return False
151-
152157
if hasattr(component, "PLATFORM_SCHEMA"):
153158
# Entity components have their own warning
154159
warn_task = None

requirements_all.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ enocean==0.50
456456
enturclient==0.2.0
457457

458458
# homeassistant.components.environment_canada
459-
env_canada==0.0.27
459+
env_canada==0.0.29
460460

461461
# homeassistant.components.envirophat
462462
# envirophat==0.0.6
@@ -622,7 +622,7 @@ hass-nabucasa==0.22
622622
hbmqtt==0.9.5
623623

624624
# homeassistant.components.jewish_calendar
625-
hdate==0.9.1
625+
hdate==0.9.3
626626

627627
# homeassistant.components.heatmiser
628628
heatmiserV3==0.9.1
@@ -1328,7 +1328,7 @@ pymsteams==0.1.12
13281328
pymusiccast==0.1.6
13291329

13301330
# homeassistant.components.myq
1331-
pymyq==2.0.0
1331+
pymyq==2.0.1
13321332

13331333
# homeassistant.components.mysensors
13341334
pymysensors==0.18.0
@@ -1423,7 +1423,7 @@ pyrepetier==3.0.5
14231423
pysabnzbd==1.1.0
14241424

14251425
# homeassistant.components.saj
1426-
pysaj==0.0.12
1426+
pysaj==0.0.13
14271427

14281428
# homeassistant.components.sony_projector
14291429
pysdcp==1
@@ -1564,7 +1564,7 @@ python-ripple-api==0.0.3
15641564
python-sochain-api==0.0.2
15651565

15661566
# homeassistant.components.songpal
1567-
python-songpal==0.11.1
1567+
python-songpal==0.11.2
15681568

15691569
# homeassistant.components.synologydsm
15701570
python-synology==0.2.0

requirements_test_all.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ hass-nabucasa==0.22
230230
hbmqtt==0.9.5
231231

232232
# homeassistant.components.jewish_calendar
233-
hdate==0.9.1
233+
hdate==0.9.3
234234

235235
# homeassistant.components.here_travel_time
236236
herepy==0.6.3.1

tests/test_requirements.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,17 @@ async def test_install_missing_package(hass):
112112
async def test_get_integration_with_requirements(hass):
113113
"""Check getting an integration with loaded requirements."""
114114
hass.config.skip_pip = False
115-
mock_integration(hass, MockModule("test_component", requirements=["hello==1.0.0"]))
115+
mock_integration(
116+
hass, MockModule("test_component_dep", requirements=["test-comp-dep==1.0.0"])
117+
)
118+
mock_integration(
119+
hass,
120+
MockModule(
121+
"test_component",
122+
requirements=["test-comp==1.0.0"],
123+
dependencies=["test_component_dep"],
124+
),
125+
)
116126

117127
with patch(
118128
"homeassistant.util.package.is_installed", return_value=False
@@ -126,8 +136,13 @@ async def test_get_integration_with_requirements(hass):
126136
assert integration
127137
assert integration.domain == "test_component"
128138

129-
assert len(mock_is_installed.mock_calls) == 1
130-
assert len(mock_inst.mock_calls) == 1
139+
assert len(mock_is_installed.mock_calls) == 2
140+
assert mock_is_installed.mock_calls[0][1][0] == "test-comp==1.0.0"
141+
assert mock_is_installed.mock_calls[1][1][0] == "test-comp-dep==1.0.0"
142+
143+
assert len(mock_inst.mock_calls) == 2
144+
assert mock_inst.mock_calls[0][1][0] == "test-comp==1.0.0"
145+
assert mock_inst.mock_calls[1][1][0] == "test-comp-dep==1.0.0"
131146

132147

133148
async def test_install_with_wheels_index(hass):

tests/test_setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,3 +527,11 @@ async def mock_callback(hass, component):
527527
setup.async_when_setup(hass, "test", mock_callback)
528528
await hass.async_block_till_done()
529529
assert calls == ["test", "test"]
530+
531+
532+
async def test_setup_import_blows_up(hass):
533+
"""Test that we handle it correctly when importing integration blows up."""
534+
with mock.patch(
535+
"homeassistant.loader.Integration.get_component", side_effect=ValueError
536+
):
537+
assert not await setup.async_setup_component(hass, "sun", {})

0 commit comments

Comments
 (0)