Add comprehensive test suite for image processing and related services
- Implement tests for database generator to ensure proper session handling. - Create tests for EXIF extraction and conversion functions. - Add tests for image-related endpoints, ensuring proper data retrieval and isolation between clients. - Develop tests for OCR functionality, including language detection and text extraction. - Introduce tests for the image processing pipeline, covering success and failure scenarios. - Validate rate limiting functionality and ensure independent counters for different clients. - Implement scraper tests to verify HTML content fetching and error handling. - Add unit tests for various services, including storage and filename generation. - Establish worker entry point for ARQ to handle background image processing tasks.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
.PHONY: help install install-dev lint format test test-cov serve worker docker-up docker-down clean
|
||||
|
||||
help: ## Affiche l'aide
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
|
||||
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
# ── Installation ──────────────────────────────────────────────
|
||||
|
||||
install: ## Installer les dépendances de production
|
||||
pip install -r requirements.txt
|
||||
|
||||
install-dev: ## Installer les dépendances de dev + pre-commit
|
||||
pip install -r requirements-dev.txt
|
||||
pre-commit install
|
||||
|
||||
# ── Qualité du code ───────────────────────────────────────────
|
||||
|
||||
lint: ## Linter le code (ruff check + mypy)
|
||||
ruff check app/ tests/
|
||||
mypy app/ --ignore-missing-imports
|
||||
|
||||
format: ## Formater le code (ruff format)
|
||||
ruff format app/ tests/
|
||||
ruff check --fix app/ tests/
|
||||
|
||||
# ── Tests ─────────────────────────────────────────────────────
|
||||
|
||||
test: ## Lancer les tests
|
||||
python -m pytest tests/ -v --tb=short
|
||||
|
||||
test-cov: ## Lancer les tests avec couverture
|
||||
python -m pytest tests/ -v --tb=short --cov=app --cov-report=term-missing --cov-report=html
|
||||
|
||||
# ── Serveur ───────────────────────────────────────────────────
|
||||
|
||||
serve: ## Démarrer le serveur de développement
|
||||
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
|
||||
|
||||
worker: ## Démarrer le worker ARQ
|
||||
python worker.py
|
||||
|
||||
# ── Docker ────────────────────────────────────────────────────
|
||||
|
||||
docker-up: ## Démarrer tous les services Docker
|
||||
docker-compose up -d --build
|
||||
|
||||
docker-down: ## Arrêter tous les services Docker
|
||||
docker-compose down -v
|
||||
|
||||
# ── Nettoyage ─────────────────────────────────────────────────
|
||||
|
||||
clean: ## Nettoyer les fichiers temporaires
|
||||
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -type d -name .mypy_cache -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -type d -name htmlcov -exec rm -rf {} + 2>/dev/null || true
|
||||
find . -name "*.pyc" -delete 2>/dev/null || true
|
||||
Reference in New Issue
Block a user