diff --git a/backend/tests/Dockerfile.test b/backend/tests/Dockerfile.test index ae987c4..374e1b2 100644 --- a/backend/tests/Dockerfile.test +++ b/backend/tests/Dockerfile.test @@ -1,14 +1,17 @@ -# Use a base Python image FROM python:3.9-slim -# Set the working directory in the container WORKDIR /app -# Copy the application code into the container -COPY . /app +# Install dependencies from backend/requirements.txt +COPY ../backend/requirements.txt /app/requirements.txt +RUN pip install --no-cache-dir -r requirements.txt -# Install dependencies (including coverage) -RUN pip install --no-cache-dir -r requirements.txt && pip install --no-cache-dir coverage +# Install coverage (if not in requirements.txt) +RUN pip install --no-cache-dir coverage -# Run Django tests with coverage -CMD ["sh", "-c", "coverage run manage.py test"] +# Copy application code and tests into the container +COPY ../backend /app/backend +COPY . /app/tests + +# Run tests with coverage +CMD ["bash", "-c", "pytest --cov=backend --cov-report=xml"]