mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-30 08:46:03 +00:00
ci: fix HA-harness tests — asyncio_mode=auto (pytest.ini), per-module enable_custom_integrations fixture instead of a global autouse that broke sync tests
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[pytest]
|
||||
asyncio_mode = auto
|
||||
testpaths = tests_backend
|
||||
@@ -1,7 +1,6 @@
|
||||
"""Shared fixtures. HA-harness tests are skipped when homeassistant is not installed
|
||||
(the local sandbox has Python 3.10; CI runs them on 3.13 with
|
||||
pytest-homeassistant-custom-component)."""
|
||||
import pytest
|
||||
"""Shared test config. HA-harness tests (test_ha_*.py) are skipped when
|
||||
homeassistant is not installed: the local sandbox has Python 3.10, CI runs them
|
||||
on 3.13 with pytest-homeassistant-custom-component."""
|
||||
|
||||
try:
|
||||
import homeassistant # noqa: F401
|
||||
@@ -10,10 +9,3 @@ except ImportError:
|
||||
HAS_HA = False
|
||||
|
||||
collect_ignore_glob = [] if HAS_HA else ["test_ha_*.py"]
|
||||
|
||||
|
||||
if HAS_HA:
|
||||
@pytest.fixture(autouse=True)
|
||||
def auto_enable_custom_integrations(enable_custom_integrations):
|
||||
"""Allow loading custom_components in the test hass."""
|
||||
yield
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
"""Config flow tests (run in CI with pytest-homeassistant-custom-component)."""
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _enable_custom_integrations(enable_custom_integrations):
|
||||
"""Allow loading custom_components in the test hass."""
|
||||
yield
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
"""Entry setup/unload tests (CI)."""
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _enable_custom_integrations(enable_custom_integrations):
|
||||
"""Allow loading custom_components in the test hass."""
|
||||
yield
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from pytest_homeassistant_custom_component.common import MockConfigEntry
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
"""HTTP upload endpoint tests (CI)."""
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _enable_custom_integrations(enable_custom_integrations):
|
||||
"""Allow loading custom_components in the test hass."""
|
||||
yield
|
||||
|
||||
from aiohttp import FormData
|
||||
from homeassistant.core import HomeAssistant
|
||||
from pytest_homeassistant_custom_component.common import MockConfigEntry
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
"""WebSocket API tests (CI): layout ops, config rev conflict, not_ready gate."""
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _enable_custom_integrations(enable_custom_integrations):
|
||||
"""Allow loading custom_components in the test hass."""
|
||||
yield
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from pytest_homeassistant_custom_component.common import MockConfigEntry
|
||||
from pytest_homeassistant_custom_component.typing import WebSocketGenerator
|
||||
|
||||
Reference in New Issue
Block a user