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
bashuv run pytestuv run pytest tests/test_app.py -q
Usage
pythonfrom longlink.testclient import TestClientfrom main import appclient = TestClient(app)def test_healthcheck() -> None:"""Return the LongLink runtime health payload."""response = client.get("/health")assert response.status_code == 200