Welcome 👋#
Currently we have three types of tests:
- Unit (
tests/) - Integration (
tests/integration) - End-to-end (
tests/e2e)
Integration & E2E tests will be ignored by default when running pytest. This is done via the pyproject.toml file in the root /backend directory.
You must explicitly run them like so:
poetry run pytest tests/e2e or poetry run pytest tests/integration, or run a specific subdirectory within it; e.g poetry run pytest tests/integration/cloudfunctions/.
Integration Tests#
To run integration tests within Docker, you can run the following command:
docker compose run --rm --remove-orphans integration-tests
If you have all services running locally, you can run the integration tests with the following command:
poetry run pytest tests/integration
Mocks#
We also have a mock directory that contains mock objects (TODO add more info).
Debugging tests#
If you would like to include print statements in succeeding tests for debugging or further testing you can include -s as an option when running pytest:
# This will print everything that uses `print()`
poetry run pytest -s tests/
# Run test in watch mode
poetry run ptw . -v tests/core/stripe/test_billing_event.py
TODO#
We should likely refactor our unit tests to be in its own tests/unit folder, but did not want to include this as part of this PR.