-
-
Notifications
You must be signed in to change notification settings - Fork 307
Testing Quick Setup
crocodilestick edited this page Oct 24, 2025
·
2 revisions
- Python 3.12+ installed
- Docker installed and running
- Git (you already have this if you cloned the repo)
# 1. Clone the repository
git clone https://github.com/crocodilestick/Calibre-Web-Automated.git
cd Calibre-Web-Automated
# 2. Create virtual environment
python3 -m venv .venv
# 3. Activate virtual environment
source .venv/bin/activate # Linux/Mac
# OR
.venv\Scripts\activate # Windows
# 4. Install dependencies
pip install -r requirements.txt
pip install pytest pytest-timeout pytest-flask pytest-mock faker testcontainers
# 5. You're ready to test!
./run_tests.shIf port 8085 is already in use on your system, you can specify a custom port:
# Use port 9090 instead
export CWA_TEST_PORT=9090
./run_tests.shOr set it inline:
CWA_TEST_PORT=9090 ./run_tests.shNote: The default test port is 8085 to avoid conflicts with production instances running on 8083.
Error: Docker daemon not running
Solution: Start Docker Desktop or Docker daemon
Error: Port 8083 already allocated
Solution: Use CWA_TEST_PORT to specify a different port (see above)
Error: pytest not found
Solution: Make sure venv is activated and dependencies installed:
source .venv/bin/activate
pip install pytest pytest-timeout pytest-flask pytest-mock faker testcontainersError: Python 3.12+ required
Solution: Update Python or use pyenv:
pyenv install 3.12.3
pyenv local 3.12.3- ✅ Unit Tests - Fast, no Docker needed (111 tests)
- ✅ Integration Tests - Docker required (20 tests)
- ✅ Smoke Tests - Quick environment checks (13 tests)
⚠️ Docker Tests - Require running container (9 tests)
# Just unit tests (fastest)
pytest tests/unit/ -v
# Just integration tests
pytest tests/integration/ -v
# Specific test file
pytest tests/unit/test_helper.py -v
# Single test
pytest tests/unit/test_helper.py::TestGetValidFilename::test_basic_valid_filename -vThe .venv will auto-activate in VSCode terminals. Just open a new terminal and start testing!
- See Testing-Running-Tests.md for detailed test execution
- See Testing-Guide-for-Contributors.md for writing tests