- dockerized ken + chelsty HA test instances with template fixtures - snapshot/reset/wait scripts for fixture management - integration test infrastructure with separate marker - location_tag promoted from metadata to event payload (Phase 1 flag #3) - chelsty-infra target_url points to chelsty-ha via tailnet (Phase 1 flag #1) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""Integration test fixtures.
|
|
|
|
Integration tests require real HA instances. Start them with:
|
|
|
|
docker compose -f tests/integration/docker-compose.ken.yml up -d
|
|
docker compose -f tests/integration/docker-compose.chelsty.yml up -d
|
|
tests/integration/scripts/wait-for-ha.sh http://localhost:8123
|
|
tests/integration/scripts/wait-for-ha.sh http://localhost:8124
|
|
|
|
Then set TEST_HA_TOKEN (a long-lived HA token) and run:
|
|
|
|
pytest tests/ -m integration
|
|
|
|
All tests in this module are automatically skipped when TEST_HA_TOKEN is unset.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def ha_ken_url() -> str:
|
|
return os.getenv("TEST_HA_KEN_URL", "http://localhost:8123")
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def ha_chelsty_url() -> str:
|
|
return os.getenv("TEST_HA_CHELSTY_URL", "http://localhost:8124")
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def ha_token() -> str:
|
|
token = os.getenv("TEST_HA_TOKEN", "")
|
|
if not token:
|
|
pytest.skip("TEST_HA_TOKEN not set — skipping integration tests")
|
|
return token
|