Fast reference for running tests locally.
1. Backend running:
cd /root/ai_product_visualizer
docker-compose up2. Dependencies installed:
pip install pytest pytest-asyncio httpxpytest tests/test_debug_endpoints.py -vpytest tests/test_debug_*.py -vpytest tests/test_debug_integration.py -v -spytest tests/test_debug_integration.py::TestUploadDiagnostics -v -sWhat it does:
- Checks database connectivity
- Verifies workers are running
- Checks Gemini API availability
- Determines where upload failed (API layer vs worker layer)
pytest tests/test_debug_integration.py::TestSystemHealthCheck -v -sWhat it does:
- Tests database connection
- Verifies workers & Redis
- Checks Gemini API
- Shows storage usage
- Displays video processing stats
pytest tests/test_debug_integration.py::TestVideoProcessingTracking -v -sWhat it does:
- Lists all user's videos
- Shows status breakdown
- Identifies stuck/processing videos
- Displays average processing time
pytest tests/test_debug_endpoints.py::TestSupabaseStatus -vpytest tests/test_debug_endpoints.py::TestUserVideos -vpytest tests/test_debug_endpoints.py::TestUserStorage -vpytest tests/test_debug_endpoints.py::TestRunwareJobs -vpytest tests/test_debug_endpoints.py::TestGeminiStatus -vpytest tests/test_debug_endpoints.py::TestWorkersStatus -v- Check if database record was created:
pytest tests/test_debug_integration.py::TestUploadDiagnostics::test_diagnose_upload_failure_workflow -v -s- Verify workers can process:
pytest tests/test_debug_endpoints.py::TestWorkersStatus::test_returns_workers_status -v- Verify Gemini is available:
pytest tests/test_debug_endpoints.py::TestGeminiStatus::test_returns_gemini_status -v- Check all user videos:
pytest tests/test_debug_integration.py::TestVideoProcessingTracking::test_identify_stuck_processing_videos -v -s- Check overall job stats:
pytest tests/test_debug_endpoints.py::TestRunwareJobs -v- Full system health check:
pytest tests/test_debug_integration.py::TestSystemHealthCheck -v -stests/test_debug_endpoints.py::TestSupabaseStatus::test_returns_database_status PASSED
tests/test_debug_endpoints.py::TestSupabaseStatus::test_returns_database_status FAILED
AssertionError: Expected 200, got 403
tests/test_debug_integration.py::TestSystemHealthCheck::test_full_system_health_check
============================================================
SYSTEM HEALTH CHECK
============================================================
[1/6] Database...
✓ Database connected
- Users: 42
- Videos: 187
[2/6] Workers & Redis...
✓ Workers: ✓ Running
✓ Redis: ✓ Connected
- Pending tasks: 0
| Flag | What it does |
|---|---|
-v |
Verbose output (show test names) |
-vv |
Very verbose (also show assertion details) |
-s |
Show print statements (use with integration tests) |
-x |
Stop on first failure |
--tb=short |
Shorter traceback format |
--tb=no |
No traceback at all |
-k test_name |
Run only tests matching test_name |
-m marker |
Run only tests with specific marker |
# See everything
pytest tests/ -vv -s --tb=short
# Stop on first failure
pytest tests/ -x
# Only slow tests
pytest tests/ -m slow -v
# Everything except slow tests
pytest tests/ -m "not slow" -v1. Diagnose:
pytest tests/test_debug_integration.py::TestUploadDiagnostics -v -s2. Check workers:
pytest tests/test_debug_endpoints.py::TestWorkersStatus -v3. Check database:
pytest tests/test_debug_endpoints.py::TestSupabaseStatus -v4. Full system check:
pytest tests/test_debug_integration.py::TestSystemHealthCheck -v -s1. List all videos:
pytest tests/test_debug_integration.py::TestVideoProcessingTracking -v -s2. Identify stuck videos:
pytest tests/test_debug_integration.py::TestVideoProcessingTracking::test_identify_stuck_processing_videos -v -s3. Check worker stats:
pytest tests/test_debug_endpoints.py::TestRunwareJobs -vpytest tests/test_debug_integration.py::TestSystemHealthCheck -v -s-
Combine multiple scenarios:
pytest tests/test_debug_integration.py -v -s
-
Run with timestamps:
pytest tests/ -v -s --tb=short 2>&1 | tee test_results_$(date +%s).log
-
Run specific test multiple times:
pytest tests/test_debug_endpoints.py::TestSupabaseStatus::test_returns_database_status -v --count=5
-
Show slowest tests:
pytest tests/ -v --durations=10
- Full documentation: See
README_DEBUG_TESTS.md - Test code: See
test_debug_endpoints.pyandtest_debug_integration.py - Configuration: See
pytest.ini
Last Updated: 2025-10-28 Status: Ready to use!