Skip to content

Run the Test Suite

This guide explains how to run backend tests for D2S.

Run all tests

With the containers running, execute the full pytest suite:

docker compose exec backend pytest

CI runs this same suite on every pull request and it must pass before the pull request can merge. CI leaves every optional feature flag off, so the tests gated behind ENABLE_STAC, ENABLE_CAMPAIGNS, ENABLE_IFORESTER, ENABLE_BREEDBASE and MAIL_ENABLED are skipped there. Enable them locally to run those.

Run a specific test file

docker compose exec backend pytest app/tests/api/api_v1/test_projects.py

Run tests with verbose output

docker compose exec backend pytest -v

Run tests matching a keyword

docker compose exec backend pytest -k "test_create_project"