forked from mathialm/secfit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Garima Ketan Chauhan
authored and
GitHub Enterprise
committed
Apr 2, 2025
1 parent
a80f412
commit 5756eef
Showing
1 changed file
with
8 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,25 @@ | ||
| # backend/tests/Dockerfile.test | ||
| FROM python:3.9-slim | ||
|
|
||
| # Set environment variables | ||
| ENV PYTHONDONTWRITEBYTECODE 1 | ||
| ENV PYTHONUNBUFFERED 1 | ||
|
|
||
| # Set work directory (inside container) | ||
| WORKDIR /app | ||
|
|
||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| build-essential \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Copy requirements from backend/ (parent of tests/) | ||
| # Copy backend files | ||
| COPY ../requirements.txt . | ||
|
|
||
| # Install Python dependencies | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
| RUN pip install coverage # Explicit install if not in requirements.txt | ||
|
|
||
| # Copy necessary files from project root | ||
| COPY ../manage.py . | ||
| COPY ../your_app/ ./your_app # Replace 'your_app' with your Django app name | ||
| COPY ../pytest.ini . # If you have one | ||
| COPY .coveragerc . # If you have custom coverage config | ||
| COPY ../app/ ./app # Changed from 'your_app' to 'app' | ||
| COPY ../config/ ./config # If you have Django config files | ||
|
|
||
| # Copy tests | ||
| COPY ../tests/ ./tests # If you have tests outside the app | ||
| # Install dependencies | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
| RUN pip install coverage | ||
|
|
||
| # Command to run tests with coverage | ||
| CMD ["sh", "-c", "coverage run --source='.' manage.py test && coverage report && coverage xml"] | ||
| # Run tests | ||
| CMD ["sh", "-c", "coverage run --source='app' manage.py test && coverage xml && coverage html"] |