pytest-homeassistant-custom-component
Experimental package to automatically extract test plugins for Home Assistant custom components
Decision gist · record as of 2026-08-14
Yes, if you are developing a Home Assistant custom component and want to follow the same testing patterns as core Home Assistant. The active daily maintenance and permissive MIT license make it practical. Be aware that the Python 3.14 requirement and large dependency tree may require careful environment management, and the alpha status means the API could shift with Home Assistant updates.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.14; custom_components folder structure and enable_custom_integrations fixture required for versions >=2021.6.0b0; asyncio_mode = auto config required in pytest
- Active maintenance with releases within days.
- Low install friction; however, requires Python 3.14 and a large dependency tree of 30 runtime dependencies including pytest, sqlalchemy, pydantic, and homeassistant, which may complicate environment setup.
License · maintenance · safety
MIT license (permissive) — MIT license (permissive) allows use in both open and closed projects with minimal restrictions.
last release 2026-08-08 (6 days) · last repo commit 2026-08-08 · 110 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 9,409,116 downloads/mo, #1,535 on PyPI
Alternatives
Verify before relying
pip install pytest-homeassistant-custom-component
from pytest_homeassistant_custom_component.common import MockConfigEntry
from homeassistant.core import HomeAssistant
async def test_setup(hass: HomeAssistant):
entry = MockConfigEntry(domain='my_domain')
entry.add_to_hass(hass)- Whether the Python 3.14 requirement reflects actual compatibility or is aspirational given Home Assistant's own support timeline
- Performance impact of the large dependency footprint on CI/CD pipeline times
- Stability guarantees for alpha-stage package given daily automatic updates
What it is and what it does
pytest-homeassistant-custom-component extracts testing fixtures and helper functions from Home Assistant's core test suite and packages them for use in custom component projects. It allows developers to write integration tests using the same pytest fixtures (like `hass`, `MockConfigEntry`) and patterns as the main Home Assistant repository, without needing to fork or copy test code.
The package is automatically regenerated daily to track Home Assistant releases, including beta versions. It provides fixtures for async testing, mocking, snapshots via syrupy, and other common testing scenarios. Developers import helpers from `pytest_homeassistant_custom_component.common` instead of `tests.common`, and the package handles the extraction and versioning so that custom components can stay in sync with the Home Assistant testing API.
Use it for
- Write pytest-based unit and integration tests for a Home Assistant custom component using the same fixtures as core Home Assistant
- Ensure custom component tests remain compatible with new Home Assistant releases by updating to the latest daily build
- Mock Home Assistant entities, config entries, and services in custom component tests without duplicating core test utilities
- Use snapshot testing via syrupy for custom component configuration or state validation aligned with Home Assistant conventions
- Set up async test fixtures and mocking for MQTT, database, or API-based custom components
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are developing a Home Assistant custom component and want to follow the same testing patterns as core Home Assistant.
The active daily maintenance and permissive MIT license make it practical. Be aware that the Python 3.14 requirement and large dependency tree may require careful environment management, and the alpha status means the API could shift with Home Assistant updates.
Install
pytest-homeassistant-custom-component on PyPI
Before you install
Active maintenance with releases within days. Low install friction; however, requires Python 3.14 and a large dependency tree of 30 runtime dependencies including pytest, sqlalchemy, pydantic, and homeassistant, which may complicate environment setup.
Requires Python 3.14; custom_components folder structure and enable_custom_integrations fixture required for versions >=2021.6.0b0; asyncio_mode = auto config required in pytest
License in practice
MIT license (permissive) allows use in both open and closed projects with minimal restrictions.
Quickstart
pip install pytest-homeassistant-custom-component
from pytest_homeassistant_custom_component.common import MockConfigEntry
from homeassistant.core import HomeAssistant
async def test_setup(hass: HomeAssistant):
entry = MockConfigEntry(domain='my_domain')
entry.add_to_hass(hass)
Verify before relying
- Whether the Python 3.14 requirement reflects actual compatibility or is aspirational given Home Assistant's own support timeline
- Performance impact of the large dependency footprint on CI/CD pipeline times
- Stability guarantees for alpha-stage package given daily automatic updates
Package facts
| License | MIT license permissive |
| Python support | Capped below the current Python release >=3.14 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 30 packagessqlalchemycoveragefreezegunlicense-expressionmock-openpydanticPyGithubpipdeptreepytest-asynciopytest-aiohttppytest-covpytest-freezerpytest-github-actions-annotate-failurespytest-socketpytest-timeoutpytest-unorderedpytest-pickedpytest-xdistpytestrequestsrequests-mockrespxsyrupytqdmunidiffhomeassistantaiohasupervisorSQLAlchemypaho-mqttnumpy |
| Maintenance | Actively maintained 6 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 9,409,116 / month, #1,535 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3.14Topic :: Software Development :: Testing |
Evidence: pytest_homeassistant_custom_component-0.13.355-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “home assistant custom component testing”
- pytest-homeassistant-custom-componentProvides pytest fixtures and testing utilities extracted from Home…
- homeassistant-stubsProvides PEP 484 type stubs for Home Assistant Core, enabling static…
- knx-frontendProvides a web-based user interface panel for the KNX integration in…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also adext · pytest-regressions · pytest-aiohttp · pytest-unused-fixtures · pytest-docker · homeassistant-stubs · pytest-rabbitmq · pytest-redis · pytest-deadfixtures · pytest-container