From 03d5807e87b188c7058c65a704ec2b263e8f9b15 Mon Sep 17 00:00:00 2001 From: Garima Ketan Chauhan Date: Wed, 2 Apr 2025 21:49:40 +0200 Subject: [PATCH] Update Dockerfile.test --- backend/tests/Dockerfile.test | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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"]