mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-01 18:21:30 +08:00
Demonstrates replacing Celery with Gunicorn's dirty arbiters for background task processing. Includes: - 4 task workers: Email, Image, Data, Scheduled - Stateful workers with persistent connections/caches - Streaming progress for long-running tasks - Per-app worker allocation - Flask API with 15+ endpoints - Docker deployment (single container vs Celery's 4+) - Unit tests (19 tests) and integration tests - Migration guide from Celery
36 lines
1015 B
Bash
Executable File
36 lines
1015 B
Bash
Executable File
#!/bin/bash
|
|
# Run tests for Celery Replacement example
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
GUNICORN_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
|
|
# Add gunicorn to Python path
|
|
export PYTHONPATH="$GUNICORN_ROOT:$PYTHONPATH"
|
|
|
|
cd "$SCRIPT_DIR"
|
|
|
|
echo "=========================================="
|
|
echo "Running Unit Tests"
|
|
echo "=========================================="
|
|
python -m pytest tests/test_tasks.py -v --tb=short
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "Unit tests passed!"
|
|
echo "=========================================="
|
|
|
|
# Check if integration tests should run
|
|
if [ "$1" == "--integration" ] || [ "$1" == "-i" ]; then
|
|
APP_URL="${APP_URL:-http://localhost:8000}"
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "Running Integration Tests against $APP_URL"
|
|
echo "=========================================="
|
|
python -m pytest tests/test_integration.py -v --tb=short
|
|
fi
|
|
|
|
echo ""
|
|
echo "All tests completed successfully!"
|