2023-06-12 00:33:07 +02:00
|
|
|
"""Fixtures for testing."""
|
2024-02-05 14:13:13 -08:00
|
|
|
|
2023-06-12 00:33:07 +02:00
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
# Tests in the dev enviromentment use the pytest_homeassistant_custom_component instead of
|
|
|
|
|
# a cloned HA core repo for a simple and clean structure. To still test against a HA core
|
|
|
|
|
# clone (e.g. the dev branch for which no pytest_homeassistant_custom_component exists
|
|
|
|
|
# because HA does not publish dev snapshot packages), set the HA_CLONE env variable.
|
|
|
|
|
if "HA_CLONE" in os.environ:
|
|
|
|
|
# Rewire the testing package to the cloned test modules. See the test `Dockerfile`
|
|
|
|
|
# for setup details.
|
|
|
|
|
sys.modules["pytest_homeassistant_custom_component"] = __import__("tests")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
|
|
|
def auto_enable_custom_integrations(enable_custom_integrations):
|
|
|
|
|
yield
|