test-and-lint
Run ReVision's test suite and lint/format checks the way CI does. Use before committing non-trivial changes, when tests or ruff fail, or when asked to validate the ReVision backend.
Files1
View on GitHubSKILL.md.claude/skills/test-and-lint/SKILL.md
GitHubTest, lint, and format ReVision
CI (.github/workflows/ci.yml) runs ruff check, ruff format --check, and
pytest on Python 3.11–3.13, plus a Docker build. Match it locally before
committing.
Commands
pytest # test suite (config in pyproject.toml: testpaths=tests, pythonpath=src)
ruff check . # lint: rules E, F, I, UP, B, SIM, line length 100
ruff format . # auto-format (CI runs `ruff format --check`)
In some environments
pytest/ruffare standalone binaries, not in the interpreter's site-packages. Ifpython -m pytestsays "No module named pytest", callpytest/ruffdirectly.
Test layout
Tests under tests/ mirror the module they cover (server.py → test_server.py):
test_config.py—Config.from_env()and env-var parsing.test_anthropic_client.py— mocksurllib.request.urlopen; no network.test_ratelimit.py— limiter with a monkeypatched clock.test_server.py— runs a live server on port 0 with a fake injected client.
Key testing seam
create_server(config, client=...) accepts an injected AnthropicClient, so
test_server.py runs a real server against a fake client with no network.
Preserve this seam when touching server.py — don't hardcode client
construction into the request path.
Before committing
ruff format .ruff check .pytest
Add a test alongside any behavior change, mirroring the module you touched.
Keep the backend dependency-free (stdlib only); pytest/ruff are dev-only.