This folder contains an example showing how to test an API using the built-in
TestClient
and pytest
.
The preparation of this example is described in the official documentation under testing. This demo uses SQLite, refer to Piccolo's documentation to use PostgreSQL.
- Create a Python virtual environment
- Activate the virtual environment
- Install dependencies in
requirements.txt
- Run tests using
pytest
# create a Python virtual environment
python -m venv venv
# activate
source venv/bin/activate # (Linux)
venv\Scripts\activate # (Windows)
# install dependencies
pip install -r requirements.txt
# run tests
pytest