Skip to content

Commit 76baa8b

Browse files
docs: fix e2e skip mechanism description, add CI and caching sections
Correct inaccurate claim that addopts excludes e2e tests by marker filter. The actual mechanism is pytestmark skipif conditions that check for env vars at import time. Add CI workflow section documenting the two-step test strategy and uv cache behavior.
1 parent 3ed8666 commit 76baa8b

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

docs/testing.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Running tests
44

55
```bash
6-
# Run tests (e2e excluded by default via addopts)
6+
# Run all tests (e2e tests auto-skip when env vars are absent)
77
uv run pytest
88

99
# Run a single test file or test
@@ -18,6 +18,7 @@ uv run pytest -m e2e
1818

1919
- `asyncio_mode = "auto"` -- async test functions run without `@pytest.mark.asyncio`
2020
- `--cov` is on by default via `addopts`
21+
- `addopts` does **not** filter by marker -- e2e tests are collected but skipped via `skipif`
2122

2223
## Test categories
2324

@@ -44,4 +45,26 @@ E2E tests require the following environment variables:
4445
- `TAILSCALE_API_KEY`
4546
- `TAILSCALE_TAILNET`
4647

47-
These are excluded by default via pytest `addopts`. Run with `uv run pytest -m e2e`.
48+
E2E tests use `pytestmark` with two `skipif` conditions that check for the env vars
49+
at import time via `python-decouple`. When either var is absent, all tests in the
50+
file are skipped (shown as `s` in output). This means `uv run pytest` collects e2e
51+
tests but skips them -- no marker filter is needed.
52+
53+
Run only e2e tests with `uv run pytest -m e2e`.
54+
55+
## CI workflow
56+
57+
The GitHub Actions workflow (`.github/workflows/pytest.yml`) runs on Blacksmith
58+
runners and has two test steps:
59+
60+
1. **Run unit tests** (`uv run pytest -s`) -- collects all 78 tests; e2e tests
61+
auto-skip because the secrets env vars are not injected into this step.
62+
2. **Run e2e tests** (`uv run pytest -m e2e -s`) -- runs only on `push` (not PRs)
63+
with `TAILSCALE_API_KEY` and `TAILSCALE_TAILNET` injected from repo secrets.
64+
65+
### Caching
66+
67+
`astral-sh/setup-uv@v6` caches the uv download cache (`~/.cache/uv`) by default.
68+
The `.venv` is recreated each run but packages are linked from the cache, so
69+
`uv sync --all-extras` typically completes in ~1 second. Caching the venv itself
70+
is not currently necessary given the fast install times.

0 commit comments

Comments
 (0)