Why This Matters
The repo has no tests/ directory, no pytest dependency, and no test job in .github/workflows/ (only ruff, pylint, hassfest, hacs). That means every refactor of the importlib-rglob discovery in services.py:289-301, repairs.py:276-286, and util.py:235-251 is currently validated by hand inside a running HA. PHACC plugs straight into HA's own test fixtures, so the only cost is the initial scaffolding — and once it exists, every subsequent sub-issue is a 30-line drop-in. This is the single foundational lever for the whole initiative.
Approach
Add pytest-homeassistant-custom-component to [tool.uv].dev-dependencies in pyproject.toml. Create tests/__init__.py, tests/conftest.py with an enable_custom_integrations autouse fixture, and tests/test_init.py containing one smoke test that uses MockConfigEntry(domain="spook"), calls hass.config_entries.async_setup, and asserts the entry reaches ConfigEntryState.LOADED. Add [tool.pytest.ini_options] to pyproject.toml with asyncio_mode = "auto". Create .github/workflows/test.yaml mirroring the style of ruff.yaml/pylint.yaml (uv-based, Python 3.13, uv run pytest). Pin the PHACC version to match the homeassistant>=2025.2.0 floor declared in pyproject.toml.
Acceptance Criteria
Risks & Caveats
PHACC's HA-version compatibility is strict — a bump of homeassistant>=2025.2.0 will sometimes force a PHACC bump and a coordinated set of test fixes. The symlink dance in __init__.py:36-79 will probably trip up the smoke test because link_sub_integrations writes into hass.config.config_dir; mitigate with a tmp_path-rooted config or by mocking link_sub_integrations in the smoke test.
Scores
- Impact: █████████░ 9/10
- Difficulty: ████░░░░░░ 4/10
- Short-Term ROI: ████████░░ 8/10
- Long-Term Value: ██████████ 10/10
Priority
Immediate
Dependencies
None
Why This Matters
The repo has no
tests/directory, no pytest dependency, and no test job in.github/workflows/(only ruff, pylint, hassfest, hacs). That means every refactor of the importlib-rglob discovery inservices.py:289-301,repairs.py:276-286, andutil.py:235-251is currently validated by hand inside a running HA. PHACC plugs straight into HA's own test fixtures, so the only cost is the initial scaffolding — and once it exists, every subsequent sub-issue is a 30-line drop-in. This is the single foundational lever for the whole initiative.Approach
Add
pytest-homeassistant-custom-componentto[tool.uv].dev-dependenciesinpyproject.toml. Createtests/__init__.py,tests/conftest.pywith anenable_custom_integrationsautouse fixture, andtests/test_init.pycontaining one smoke test that usesMockConfigEntry(domain="spook"), callshass.config_entries.async_setup, and asserts the entry reachesConfigEntryState.LOADED. Add[tool.pytest.ini_options]topyproject.tomlwithasyncio_mode = "auto". Create.github/workflows/test.yamlmirroring the style ofruff.yaml/pylint.yaml(uv-based, Python 3.13,uv run pytest). Pin the PHACC version to match thehomeassistant>=2025.2.0floor declared inpyproject.toml.Acceptance Criteria
uv run pytestruns locally and passestests/conftest.pyexposes theenable_custom_integrationsfixturetest.yamlGitHub workflow runs on PR/push and is required for mergepyproject.tomldocuments the PHACC pin alongside the HA version floorRisks & Caveats
PHACC's HA-version compatibility is strict — a bump of
homeassistant>=2025.2.0will sometimes force a PHACC bump and a coordinated set of test fixes. The symlink dance in__init__.py:36-79will probably trip up the smoke test becauselink_sub_integrationswrites intohass.config.config_dir; mitigate with atmp_path-rooted config or by mockinglink_sub_integrationsin the smoke test.Scores
Priority
Immediate
Dependencies
None