From 4a5220c753bc041ac69ab0a73875793f71c69ca7 Mon Sep 17 00:00:00 2001 From: Craig Barratt <19445341+craigbarratt@users.noreply.github.com> Date: Fri, 6 Nov 2026 15:16:02 +1100 Subject: [PATCH] clean up test config after pytest-homeassistant migration Follow-up to #888: - remove duplicate --asyncio-mode=auto from addopts (asyncio_mode is set in [tool:pytest]) - comment why -p no:respx is needed - filter two third-party import-time deprecation warnings (Home Assistant http server, backoff) - remove the commented-out pytest block from pyproject.toml - remove the auto_enable_custom_integrations fixture; the pytest-homeassistant hass fixture enables custom integrations by default - document uninstalling pytest-homeassistant-custom-component when upgrading a venv to Home Assistant 2026.11+ Co-Authored-By: Claude Opus 5.5 --- pyproject.toml | 4 ---- setup.cfg | 6 +++++- tests/README.md | 9 +++++++++ tests/conftest.py | 7 ------- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7bb012d5..d4a3626f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,6 @@ [tool.black] line-length = 109 -#[tool.pytest.ini_options] -#asyncio_mode = "auto" -#asyncio_default_fixture_loop_scope = "function" - [tool.ruff] target-version = "py313" line-length = 109 diff --git a/setup.cfg b/setup.cfg index 9d3fa2ee..c6a31789 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,10 +20,14 @@ asyncio_default_fixture_loop_scope = function testpaths = tests norecursedirs = .git log_level=INFO +# -p no:respx lets Home Assistant install its httpx alias before respx is imported addopts = -p no:respx --strict-markers - --asyncio-mode=auto +# third-party deprecation warnings raised at import time; not fixable in pyscript +filterwarnings = + ignore:Inheritance class HomeAssistantApplication from web.Application is discouraged:DeprecationWarning:homeassistant\.components\.http\.server + ignore:'asyncio.iscoroutinefunction' is deprecated:DeprecationWarning:backoff\._.* [mypy] python_version = 3.14 diff --git a/tests/README.md b/tests/README.md index f2362d91..c7d8d444 100644 --- a/tests/README.md +++ b/tests/README.md @@ -19,6 +19,15 @@ python -m pip install -r tests/requirements_test.txt pre-commit install ``` +If you are upgrading an existing virtual environment to Home Assistant 2026.11 or later, you must +first uninstall the old `pytest-homeassistant-custom-component` package, which has been replaced by +`pytest-homeassistant`. Its pytest plugin still loads if it is installed, and it fails with +Home Assistant 2026.11+: +```bash +venv/bin/pip uninstall -y pytest-homeassistant-custom-component +python -m pip install -r tests/requirements_test.txt +``` + To submit PRs you will want to fork the repository, and follow the steps above on your forked repository. Once you have pushed your changes to the fork (which should run the pre-commit hooks), you can go ahead and submit a PR. diff --git a/tests/conftest.py b/tests/conftest.py index 3ef73c8d..03e97177 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,13 +20,6 @@ from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component - -@pytest.fixture(autouse=True) -def auto_enable_custom_integrations(enable_custom_integrations): - """Enable custom integrations in all tests.""" - yield - - _UNSET = object()