Skip to content

Commit c902d8b

Browse files
committed
FIX: Tweak
1 parent b20fc8b commit c902d8b

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎AGENTS.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,17 @@ user-visible behavior; anything else can be added later, when something actually
6060
covers formats added later for free.
6161
- **Never promote an optional dependency to a required one** as a side effect of a feature, and do
6262
not add a dependency at all without asking first.
63-
- **Extend the existing test harness instead of adding a test module.** A new
64-
`mne/**/tests/test_<thing>.py` is a signal to stop and look: most behavior belongs in an
65-
existing test file, and new I/O behavior usually belongs in the generic
63+
- **Add to an existing test before writing a new one.** In order of preference: extend a test
64+
function that already builds the objects you need — a parametrized one especially, since the new
65+
assertion then runs across every case for free — then add to the existing test module for that
66+
code, and only then write a new test function or file. A new `mne/**/tests/test_<thing>.py` is a
67+
signal to stop and look, and new I/O behavior usually belongs in the generic
6668
`mne/io/tests/test_raw.py::_test_raw_reader`, which runs for every format. A few compact
67-
assertions that run everywhere beat hundreds of lines that run once.
69+
assertions that run everywhere beat hundreds of lines that run once, and re-created setup is one
70+
of the most common things reviewers ask to have deleted. In mne-tools/mne-python#14248 a 30-line
71+
standalone test became fewer than 10 lines added to the existing parametrized
72+
`test_anonymize_with_io`, which already had the fixture, the save/load round trip, and the
73+
`daysback` parametrization that exposed the bug.
6874
- **Check that a new API spelling does not already mean something else.** A new sentinel or
6975
keyword value (`preload="auto"`, `memmap="auto"`, ...) must not collide with an existing meaning
7076
of the same string on a related argument.

0 commit comments

Comments
 (0)