# Run all tests (e2e tests auto-skip when env vars are absent)
uv run pytest
# Run a single test file or test
uv run pytest tests/test_unit.py
uv run pytest tests/test_unit.py::test_url_join
# Run e2e tests (requires TAILSCALE_API_KEY and TAILSCALE_TAILNET env vars)
uv run pytest -m e2easyncio_mode = "auto"-- async test functions run without@pytest.mark.asyncio--covis on by default viaaddoptsaddoptsdoes not filter by marker -- e2e tests are collected but skipped viaskipif
| File | Purpose | Network? |
|---|---|---|
test_unit.py |
Pure-logic tests | No |
test_integration.py |
HTTP tests with aresponses mock server |
Mocked |
test_hypothesis.py |
Property-based tests (model roundtrips, exception messages) | No |
test_e2e.py |
Real API tests, skipped without env vars | Yes |
Integration tests use aresponses (mock aiohttp server).
The fixture is injected as aresponses: ResponsesMockServer.
Hypothesis tests use @settings(max_examples=20-50) to keep runs fast.
E2E tests require the following environment variables:
TAILSCALE_API_KEYTAILSCALE_TAILNET
E2E tests use pytestmark with two skipif conditions that check for the env vars
at import time via python-decouple. When either var is absent, all tests in the
file are skipped (shown as s in output). This means uv run pytest collects e2e
tests but skips them -- no marker filter is needed.
Run only e2e tests with uv run pytest -m e2e.
The GitHub Actions workflow (.github/workflows/pytest.yml) runs on Blacksmith
runners and has two test steps:
- Run unit tests (
uv run pytest -s) -- collects all 78 tests; e2e tests auto-skip because the secrets env vars are not injected into this step. - Run e2e tests (
uv run pytest -m e2e -s) -- runs only onpush(not PRs) withTAILSCALE_API_KEYandTAILSCALE_TAILNETinjected from repo secrets.
astral-sh/setup-uv@v6 caches the uv download cache (~/.cache/uv) by default.
The .venv is recreated each run but packages are linked from the cache, so
uv sync --all-extras typically completes in ~1 second. Caching the venv itself
is not currently necessary given the fast install times.