adaptive-lighting/tests/conftest.py
Mario Guggenberger 6283158ff7
VS Code Dev Container (dev & test environment) (#605)
* build: dev container

Add a VS Code Dev Container from the blueprint at bceaae212f

* build: dev container test setup

Add support for unit testing in the dev container environment with debugging and code coverage.

* ci: adjust to dev container test restructuring

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ci: fix coverage collection

* build: add dummy light to HA config

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* build: update dev container to Python 3.11 (for HA 2023.6)

* Add VS Code tasks

* Use pre-commit hooks for linting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Unpin HA version

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
2023-06-11 15:33:07 -07:00

19 lines
745 B
Python

"""Fixtures for testing."""
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