mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 21:02:21 +01:00
Merge pull request #4336 from rommapp/docs/no-full-backend-test-suite-locally
docs(agents): never run the full backend test suite locally
This commit is contained in:
@@ -93,7 +93,7 @@ npm run generate # writes src/__generated__/ via openapi-typescript-codegen
|
||||
```bash
|
||||
cd backend
|
||||
uv run python3 main.py # run (migrations auto-apply on startup)
|
||||
uv run pytest [path/file] # tests (subset by path); uv run pytest -vv for all
|
||||
uv run pytest <path/file> # tests - affected files only, NEVER the whole suite
|
||||
```
|
||||
|
||||
- Tests: pytest + pytest-asyncio, isolated per `pytest-xdist` worker (per-worker DBs); `fakeredis`; `pytest-recording` VCR cassettes mock external APIs; Hypothesis for property tests. Mirror the `backend/<area>/` layout under `backend/tests/`. First-time test DB setup: `docker exec -i romm-db-dev mariadb -uroot -p<pw> < backend/romm_test/setup.sql`.
|
||||
|
||||
@@ -210,7 +210,7 @@ With `uiVersion = "v2"`:
|
||||
|
||||
Run from `backend/`:
|
||||
|
||||
1. `uv run pytest [path/file]` — zero failures (run the affected subset, or all with `-vv`).
|
||||
1. `uv run pytest <path/file>` — zero failures on the tests affected by the diff. Never run the whole suite locally (20+ minutes); see [AGENTS.md](../../../AGENTS.md) for how to pick targets. CI runs it in full.
|
||||
2. `trunk fmt && trunk check` — ruff/black/isort/mypy/bandit clean (CI enforces Trunk).
|
||||
3. **If you added a migration:** `uv run alembic upgrade head` then `uv run alembic downgrade -1` to prove both directions; it must work on MariaDB **and** PostgreSQL (CI runs both).
|
||||
4. **If a response schema or route signature changed:** regenerate frontend types (`npm run generate`) and typecheck the frontend.
|
||||
|
||||
22
AGENTS.md
22
AGENTS.md
@@ -1,3 +1,25 @@
|
||||
# Repository Instructions
|
||||
|
||||
Read and follow [CLAUDE.md](CLAUDE.md) for all repository instructions.
|
||||
|
||||
## Never run the full backend test suite locally
|
||||
|
||||
A bare `uv run pytest` (or `pytest -vv`) over `backend/` takes 20+ minutes and burns a
|
||||
huge number of tokens on output. Don't do it, even to "double check" at the end.
|
||||
|
||||
Instead, select the tests affected by the change and run only those:
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
uv run pytest tests/path/to/test_file.py # one file
|
||||
uv run pytest tests/path/to/test_file.py::test_name # one test
|
||||
uv run pytest tests/handler/ tests/endpoints/ # affected areas
|
||||
uv run pytest -k "scan or queue" # by name pattern
|
||||
```
|
||||
|
||||
Pick the targets from the diff: the test file mirroring each changed module
|
||||
(`backend/<area>/x.py` → `backend/tests/<area>/test_x.py`), plus the tests of the
|
||||
callers of anything whose signature or behavior you changed (`grep` for the symbol).
|
||||
|
||||
CI runs the whole suite on the PR (`pytest.yml`, MariaDB + PostgreSQL). That is the
|
||||
place for full-suite coverage; local runs stay scoped.
|
||||
|
||||
@@ -82,7 +82,7 @@ These live in `.claude/skills/` and carry the detailed rules. Invoke the one tha
|
||||
```bash
|
||||
uv sync --all-extras --dev # install
|
||||
uv run main.py # run (migrations auto-apply)
|
||||
uv run pytest [path/file] # test (subset) - or -vv for all
|
||||
uv run pytest <path/file> # test - affected files only, NEVER the whole suite
|
||||
uv run alembic revision --autogenerate -m "msg" # new migration (then HAND-REVIEW)
|
||||
uv run alembic upgrade head # apply migrations
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user