@@ -15,6 +15,7 @@ A Django RESTful API for managing personal or team tasks — featuring PostgreSQ
1515- ✅ Swagger UI for API documentation
1616- ✅ Containerized with Docker
1717- ✅ CLI scripts for development and production modes
18+ - ✅ Pytest-based testing with coverage
1819
1920---
2021
@@ -24,13 +25,16 @@ A Django RESTful API for managing personal or team tasks — featuring PostgreSQ
2425taskflow-api/
2526├── taskflow_api/ # Django project (includes celery.py)
2627├── tasks/ # App: task models, views, serializers, signals, celery tasks
28+ ├── tests/ # Pytest tests for models, API, celery tasks
2729├── requirements.txt # Python dependencies
2830├── Dockerfile # Production image for gunicorn
2931├── docker-compose.yml # DB and RabbitMQ container setup
3032├── .env # Environment configuration
3133├── logs/ # Directory for activity logs (auto-created)
3234├── run_server.sh # Run production server (Gunicorn)
33- └── start-dev-services.sh # Run DB + RabbitMQ for development
35+ ├── start-dev-services.sh # Run DB + RabbitMQ for development
36+ ├── lint-clean.sh # Ruff lint & formatting script
37+ └── pytest.ini # Pytest configuration
3438```
3539
3640---
@@ -100,6 +104,26 @@ Open:
100104
101105---
102106
107+ ## 🧪 Run Tests and Coverage
108+
109+ ### ▶️ Run all tests
110+ ``` bash
111+ pytest
112+ ```
113+
114+ ### ▶️ Run tests ** with coverage** (after installing ` pytest-cov ` )
115+ ``` bash
116+ pytest --cov=. --cov-report=term-missing
117+ ```
118+
119+ ### ▶️ (Optional) Generate HTML coverage report
120+ ``` bash
121+ pytest --cov=. --cov-report=html
122+ # Open htmlcov/index.html in your browser
123+ ```
124+
125+ ---
126+
103127## 🧩 Celery Logging Task
104128
105129When a task is created through the API, a Celery worker will automatically:
@@ -139,10 +163,12 @@ docker compose up --build
139163- ** Broker** : RabbitMQ (Docker)
140164- ** Background Jobs** : Celery (activity logging)
141165- ** Containerization** : Docker, Docker Compose
166+ - ** Testing** : Pytest, pytest-django, pytest-cov
167+ - ** Linting** : Ruff
142168- ** CI-ready** : Gunicorn + environment-based config
143169
144170---
145171
146172## 📜 License
147173
148- MIT © Omid Hashemzadeh
174+ MIT © Omid Hashemzadeh
0 commit comments