Skip to content

Clean up test config after pytest-homeassistant migration - #889

Merged
craigbarratt merged 1 commit into
masterfrom
test-config-cleanup
Nov 6, 2026
Merged

craigbarratt merged 1 commit into
masterfrom
test-config-cleanup

Conversation

@craigbarratt

Copy link
Copy Markdown
Member

Follow-up to #888, which moved the tests from pytest-homeassistant-custom-component to pytest-homeassistant. These are small cleanups found while reviewing #888.

Changes

setup.cfg

  • Removed --asyncio-mode=auto from addopts. Migrate tests to pytest-homeassistant #888 added asyncio_mode = auto to [tool:pytest], so the setting was in two places, and the command-line copy would silently win if they ever differed.
  • Added a comment explaining -p no:respx. Home Assistant 2026.11 aliases httpx to httpx2 when it's imported, and raises RuntimeError: httpx was already imported if something imports httpx first. respx's pytest plugin does that, so it has to stay disabled.
  • Added filterwarnings entries for two deprecation warnings raised at import time by third-party code. Each entry is limited to its message and module, so other warnings (including any from pyscript) are still reported:
    • homeassistant.components.http.server: aiohttp discourages subclassing web.Application
    • backoff: uses asyncio.iscoroutinefunction, which is deprecated in Python 3.14

pyproject.toml

  • Removed the commented-out [tool.pytest.ini_options] block. The pytest config lives in setup.cfg.

tests/conftest.py

  • Removed the autouse auto_enable_custom_integrations fixture. In pytest-homeassistant, the hass fixture enables custom integrations by default (the custom_integrations_enabled fixture returns True).

tests/README.md

  • Added a note that upgrading an existing venv to Home Assistant 2026.11+ requires venv/bin/pip uninstall -y pytest-homeassistant-custom-component. Changing the pin in requirements_test.txt doesn't remove the old package, and its pytest plugin still loads automatically. On 2026.11 it fails at startup: it imports respx/httpx before Home Assistant (the RuntimeError above), and its copy of common.py imports _clear_logger_overwrites, which 2026.11 removed.

Testing

  • pytest with Home Assistant 2026.11.0 and pytest-homeassistant 2026.11.0: 180 passed, no warnings, both serial and with -n 8.
  • pre-commit hooks (ruff, codespell, pylint, mypy) pass.

🤖 Generated with Claude Code

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 <[email protected]>
@craigbarratt
craigbarratt merged commit 1151283 into master Nov 6, 2026
11 checks passed
@craigbarratt
craigbarratt deleted the test-config-cleanup branch November 6, 2026 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant