Testing

Test your project with standard pytest(opens in new tab) and pytest-asyncio(opens in new tab) workflows.

Import TestClient from longlink.testclient instead of fastapi.testclient. The import selects the testing environment with isolated in-memory services, so no environment setup is needed. Keep the client import above the application import so the environment applies when the app is created.

TODO

bash
uv run pytest
uv run pytest tests/test_app.py -q

Usage

python
from longlink.testclient import TestClient
from main import app
client = TestClient(app)
def test_healthcheck() -> None:
"""Return the LongLink runtime health payload."""
response = client.get("/health")
assert response.status_code == 200