Skip to content

Commit c541d5c

Browse files
authored
Merge pull request #4 from sinricpro/develop
Develop
2 parents 9ceb865 + 0b12a45 commit c541d5c

5 files changed

Lines changed: 20 additions & 19 deletions

File tree

custom_components/sinricpro/config_flow.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
import logging
66
from typing import Any
77

8-
import voluptuous as vol # type: ignore[import-untyped]
8+
import voluptuous as vol
99
from homeassistant.config_entries import ConfigEntry
1010
from homeassistant.config_entries import ConfigFlow
11-
from homeassistant.config_entries import ConfigFlowResult # type: ignore[attr-defined]
11+
from homeassistant.config_entries import ConfigFlowResult
1212
from homeassistant.config_entries import OptionsFlow
1313
from homeassistant.const import CONF_API_KEY
1414
from homeassistant.core import callback
@@ -43,7 +43,7 @@ def __init__(self) -> None:
4343
@callback
4444
def async_get_options_flow(config_entry: ConfigEntry) -> SinricProOptionsFlow:
4545
"""Get the options flow for this handler."""
46-
return SinricProOptionsFlow(config_entry)
46+
return SinricProOptionsFlow()
4747

4848
async def async_step_user(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult:
4949
"""Handle the initial step.
@@ -201,14 +201,6 @@ async def _validate_api_key(self, api_key: str) -> str | None:
201201
class SinricProOptionsFlow(OptionsFlow):
202202
"""Handle options flow for SinricPro."""
203203

204-
def __init__(self, config_entry: ConfigEntry) -> None:
205-
"""Initialize options flow.
206-
207-
Args:
208-
config_entry: The config entry.
209-
"""
210-
self.config_entry = config_entry
211-
212204
async def async_step_init(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult:
213205
"""Manage the options.
214206

custom_components/sinricpro/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
"iot_class": "cloud_push",
88
"issue_tracker": "https://github.com/sinricpro/homeassistant-sinricpro/issues",
99
"requirements": ["aiohttp>=3.9.0"],
10-
"version": "2.0.0"
10+
"version": "2.0.1"
1111
}

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "sinricpro-homeassistant"
3-
version = "2.0.0"
3+
version = "2.0.1"
44
description = "SinricPro integration for Home Assistant"
55
readme = "README.md"
66
license = {text = "MIT"}
@@ -62,7 +62,7 @@ force-single-line = true
6262
known-first-party = ["custom_components.sinricpro"]
6363

6464
[tool.mypy]
65-
python_version = "3.11"
65+
python_version = "3.12"
6666
warn_return_any = true
6767
warn_unused_ignores = true
6868
disallow_untyped_defs = true

requirements_test.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
pytest>=8.0.0,<8.1
2-
pytest-asyncio
3-
pytest-cov
1+
# pytest, pytest-asyncio and pytest-cov are provided (and version-pinned to
2+
# match Home Assistant) by pytest-homeassistant-custom-component. Do not pin
3+
# them here or pip resolution will conflict with the HA-pinned versions.
44
pytest-homeassistant-custom-component>=0.13.0
55
aioresponses>=0.7.6
66
ruff>=0.4.0

tests/test_api.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,17 @@ def api_url() -> str:
2727

2828
@pytest.fixture
2929
async def session() -> aiohttp.ClientSession:
30-
"""Create aiohttp session."""
31-
async with aiohttp.ClientSession() as session:
30+
"""Create aiohttp session.
31+
32+
Use the ThreadedResolver instead of aiohttp's default aiodns/pycares
33+
resolver. pycares eagerly starts a process-global daemon thread
34+
(``_run_safe_shutdown_loop``) when its DNS channel is created, and that
35+
thread never exits, which trips pytest-homeassistant-custom-component's
36+
``verify_cleanup`` thread-leak assertion at teardown. aioresponses mocks
37+
every request here, so the resolver is never actually used.
38+
"""
39+
connector = aiohttp.TCPConnector(resolver=aiohttp.ThreadedResolver())
40+
async with aiohttp.ClientSession(connector=connector) as session:
3241
yield session
3342

3443

0 commit comments

Comments
 (0)