mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
58 lines
1.9 KiB
Docker
58 lines
1.9 KiB
Docker
# See tests/README.md for instructions on how to run the tests.
|
|
|
|
# tl;dr:
|
|
# Run the following command in the adaptive-lighting repo folder to run the tests:
|
|
# docker run -v $(pwd):/app basnijholt/adaptive-lighting:latest
|
|
|
|
# Optionally build the image yourself with:
|
|
# docker build -t basnijholt/adaptive-lighting:latest .
|
|
|
|
FROM python:3.11-buster
|
|
|
|
RUN apt-get update && \
|
|
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Clone home-assistant/core
|
|
RUN git clone --depth 1 https://github.com/home-assistant/core.git /core
|
|
|
|
# Install home-assistant/core dependencies
|
|
RUN pip3 install -r /core/requirements.txt --use-pep517 && \
|
|
pip3 install -r /core/requirements_test.txt --use-pep517 && \
|
|
pip3 install -e /core/ --use-pep517
|
|
|
|
# Clone the Adaptive Lighting repository
|
|
RUN git clone https://github.com/basnijholt/adaptive-lighting.git /app
|
|
|
|
# Setup symlinks in core
|
|
RUN ln -s /app/custom_components/adaptive_lighting /core/homeassistant/components/adaptive_lighting && \
|
|
ln -s /app/tests /core/tests/components/adaptive_lighting && \
|
|
# For test_dependencies.py
|
|
ln -s /core /app/core
|
|
|
|
# Install dependencies of components that Adaptive Lighting depends on
|
|
RUN pip3 install $(python3 /app/test_dependencies.py) --use-pep517
|
|
|
|
WORKDIR /core
|
|
|
|
CMD ["python3", \
|
|
# Enable Python development mode
|
|
"-X", "dev", \
|
|
# Run pytest
|
|
"-m", "pytest", \
|
|
# Verbose output
|
|
"-vvv", \
|
|
# Set a timeout of 9 seconds per test
|
|
"--timeout=9", \
|
|
# Print the 10 slowest tests
|
|
"--durations=10", \
|
|
# Measure code coverage for the 'homeassistant' package
|
|
"--cov='homeassistant'", \
|
|
# Generate an XML report of the code coverage
|
|
"--cov-report=xml", \
|
|
# Print a count of test results in the console
|
|
"-o", "console_output_style=count", \
|
|
# Run tests in the 'tests/components/adaptive_lighting' directory
|
|
"tests/components/adaptive_lighting" \
|
|
]
|