Skip to content

Commit bfcddcf

Browse files
committed
Teach copilot about pseudo-fixtures
1 parent fb72e11 commit bfcddcf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/copilot-instructions.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,23 @@ Core grug beliefs to apply when reviewing:
2020
- Simple APIs good. Layered APIs ok. Java streams make grug reach for club
2121
- SPA frameworks increase complexity demon surface area — be suspicious
2222
- Saying "this too complex for grug" is senior developer superpower — remove Fear Of Looking Dumb (FOLD)
23+
24+
## Pytest conventions in this repo
25+
26+
Before flagging fixture/parametrize issues, remember how pytest resolves names:
27+
28+
- `@pytest.mark.parametrize("foo,bar", [...])` makes `foo` and `bar` behave like
29+
pseudo-fixtures for the entire test call. Any fixture the test depends on
30+
(directly or transitively) can request `foo` in its own signature and
31+
pytest will inject the parametrized value.
32+
- This means a parametrize argname does NOT need to appear in the test
33+
function's own signature, and there does NOT need to be a separate
34+
`@pytest.fixture` defined with that name, as long as some dependent fixture
35+
requests it. `indirect=True` is only required when you want pytest to route
36+
the value through an actual fixture function.
37+
- Concretely, in `test/plugins/test_discogs.py::TestAnv`, `anv_config` is fed
38+
to the `album_info` fixture via this mechanism — this is valid and will
39+
not raise "fixture not found".
40+
41+
When in doubt, check collection with `pytest --collect-only` before claiming
42+
the suite is broken. grug not bark if tests actually pass.

0 commit comments

Comments
 (0)