-
Run all tests (excluding those requiring real DBs, see item 3):
uv run pytest
**Useful Flags:** - `-v` (verbose): Shows more detailed output, including each test name as it runs. - `-s` (no capture): Allows stdout (print statements) to show in the console. Useful for debugging. Example with flags: ```bash uv run pytest -v -sNote: Some tests require external databases (PostgreSQL, MySQL) and will be skipped if the corresponding environment variables (
POSTGRES_TEST_DSN,MYSQL_TEST_DSN) are not set. -
Run specific tests:
# Run a specific test file uv run pytest tests/client/test_client_factory.py # Run a specific test function uv run pytest tests/client/test_client_factory.py::test_client_factory_connect_with_url # Run tests in a specific folder uv run pytest tests/client/
-
Run database integration tests (requires Docker):
./scripts/run_db_tests.sh
This script will:
- Start PostgreSQL and MySQL containers using Docker Compose.
- Run the database integration tests.
- Stop the containers after tests finish.
You can also run tests for a specific database:
./scripts/run_db_tests.sh --postgres # or ./scripts/run_db_tests.sh --mysqlTo keep the databases running for debugging:
./scripts/run_db_tests.sh --debug
(Follow the onscreen instructions to export DSNs and run pytest manually).
In case of failures, you can clean up the cache:
uv cleanrm -fR .pytest_cache .venv __pycache__