adaptive-lighting/tests
Casey Romkes 027a6de184
ci: migrate pytest + Docker to PHCC (retire HA core-checkout harness) (#3)
* openspec: propose migrate-ci-to-phcc (proposal + design)

Design-first per repo convention. Migrates pytest + Docker CI off the dead HA core-checkout harness to the PHCC-based local test suite that already passes locally (164). Implementation (tasks + code) held pending review of the design's open questions.

* ci: migrate pytest + Docker off HA core-checkout to PHCC

Implements openspec change migrate-ci-to-phcc.

- pytest.yaml: run the local PHCC suite (latest + dev matrix; dev is
  continue-on-error). Fixes the trigger (was push:[master] -> never ran on
  main; now main). Drops coverage (was computed but never uploaded). Recipe
  verified in a clean env locally: 164 passed, Python 3.13, latest PHCC.
- Delete dead core-checkout scaffolding: install_dependencies action,
  setup-dependencies, setup-symlinks, update-test-matrix.{py,yaml},
  test_dependencies.py, Dockerfile, docker-build.yml.
- setup-devcontainer: PHCC flow (uv sync --group test).
- tests/README.md: rewritten for 'uv run pytest'.
- CLAUDE.md: drop the 'Refresh test matrix' row.
- hacs.json 2024.12.0 -> 2026.1.0; README min-version line corrected (it
  wrongly claimed '2025.1.0 pinned in manifest.json' - manifest pins none).

* openspec: mark migrate-ci-to-phcc 4.3 done (CI verified green)
2026-07-09 13:31:53 +02:00
..
__init__.py Copy tests from https://github.com/home-assistant/core/pull/40626 2022-08-28 12:05:31 -07:00
conftest.py Implement add-runtime-range-controls 2026-05-16 22:24:39 +02:00
README.md ci: migrate pytest + Docker to PHCC (retire HA core-checkout harness) (#3) 2026-07-09 13:31:53 +02:00
test_adaptation_utils.py Auto-fix unused imports across tests + switch.py (ruff --fix) 2026-05-16 15:12:19 +02:00
test_color_and_brightness.py Fix sun-event day-anchoring: curve collapsed to min in summer afternoons 2026-06-07 20:26:42 +02:00
test_config_flow.py Clean up all remaining ruff errors; lint is now fully green 2026-06-05 12:16:40 +02:00
test_hass_utils.py Auto-fix unused imports across tests + switch.py (ruff --fix) 2026-05-16 15:12:19 +02:00
test_init.py Clean up all remaining ruff errors; lint is now fully green 2026-06-05 12:16:40 +02:00
test_number_platform.py Implement add-runtime-ramp-width: live ramp half-width number entity 2026-06-07 22:30:58 +02:00
test_sensor_platform.py lux_reduction sensor: report reduction %, not retained factor 2026-05-30 22:35:59 +02:00

Developer notes for the tests directory

The tests use pytest-homeassistant-custom-component (PHCC), which bundles a pinned Home Assistant plus its test fixtures. No Home Assistant core checkout is required (the old clone-core + symlink + Docker flow has been retired).

Running the tests

From the repo root:

uv run pytest

uv builds the environment from pyproject.toml (the test dependency group pulls in PHCC, pytest, and pytest-asyncio), and testpaths = ["tests"] scopes collection to this directory. Pass pytest arguments straight through:

uv run pytest tests/test_number_platform.py -k ramp -vv

What CI runs

.github/workflows/pytest.yaml runs the same suite on two matrix entries:

  • stable — the latest released PHCC (current stable HA).
  • dev — the latest PHCC pre-release (--pre, upcoming HA beta), marked continue-on-error so a missing or flaky pre-release never fails the build.

To reproduce a CI entry in a throwaway environment:

PYTHONPATH="$PWD" uv run --no-project \
  --with pytest-homeassistant-custom-component --with pytest \
  --with pytest-asyncio --with ulid-transform \
  pytest -q