✅ All test code is syntactically correct and ready to run
- 5 test modules compile successfully
- conftest.py with 6 fixtures ready
- pytest.ini configuration valid
- 81 test cases defined
- Container cannot reach PyPI due to certificate verification failure
- This is a network/certificate configuration issue with the Docker environment
- Does NOT affect test code validity
# Create virtual environment
cd stacks/web/images/cae-dashboard
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=app --cov-report=htmlOnce the container's SSL certificate issue is resolved:
# Install dependencies (will work when SSL is fixed)
docker exec cae-dashboard pip install -r requirements.txt
# Run tests
docker exec cae-dashboard pytest tests/ -v
# Run with coverage
docker exec cae-dashboard pytest tests/ --cov=app --cov-report=htmlIf pytest needs to run in container immediately, use pre-built images or volumes:
# Build custom image with pytest pre-installed
docker build -t cae-dashboard:test -f Dockerfile.test .
# Or mount venv from host
docker run -v $(pwd)/.venv:/app/.venv cae-dashboard pytest tests/pytest tests/services/test_helpers.py -vpytest tests/services/test_helpers.py::TestComputeYoY -vpytest tests/services/test_helpers.py::TestComputeYoY::test_yoy_basic_monthly -vpytest -k "test_yoy" -v
pytest -k "test_painel" -vpytest --cov=app --cov-report=html
# Open htmlcov/index.html in browserpytest tests/ -vv -xpytest --lf -vThe container's SSL certificate issue can be fixed by:
-
Update CA certificates in container:
docker exec cae-dashboard apt-get update && apt-get install -y ca-certificates
-
Use pip with insecure mode (not recommended):
docker exec cae-dashboard pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org -r requirements.txt -
Rebuild container with cert updates in Dockerfile:
RUN apt-get update && apt-get install -y ca-certificates RUN pip install -r requirements.txt
-
Use a Docker network with proper DNS:
- Ensure container has correct
/etc/resolv.conf - Verify network connectivity:
docker exec cae-dashboard curl https://pypi.org
- Ensure container has correct
All test files have been verified to compile correctly:
✅ tests/services/test_helpers.py — 190 lines, 25 tests
✅ tests/services/test_painel.py — 240 lines, 15 tests
✅ tests/services/test_painel_headline.py — 230 lines, 14 tests
✅ tests/routes/test_api_painel.py — 190 lines, 12 tests
✅ tests/db/test_duckdb_basic.py — 260 lines, 15 tests
✅ tests/conftest.py — 150 lines, 6 fixturesTotal: 1,260 lines of test code, 81 tests, all syntactically valid
- Fix SSL issue in container (see above)
- Run tests locally (recommended for immediate feedback)
- Integrate with CI/CD (Phase 3) once SSL is resolved
- Tests are designed to run offline (no external API calls required)
- Database tests gracefully skip if
CAE_DB_PATHnot available - All fixtures are self-contained in conftest.py
- Coverage target: 75% by end of Phase 4
Status: ✅ Ready to run. Just need to install pytest dependencies (locally or fix container SSL).