Skip to content

tests: use rstest for table tests and the lang cases - #231

Merged
Mic92 merged 13 commits into
mainfrom
rstest
Oct 23, 2026
Merged

Mic92 merged 13 commits into
mainfrom
rstest

Conversation

@Mic92

@Mic92 Mic92 commented Oct 22, 2026

Copy link
Copy Markdown
Member

Each row of a table test becomes its own test, so one failing row no longer hides the others. The lang cases come from rstest's #[files] instead of build.rs.

Base automatically changed from hermetic-home to main October 22, 2026 20:28
@Mic92
Mic92 enabled auto-merge October 22, 2026 20:38
@Mic92
Mic92 force-pushed the rstest branch 3 times, most recently from e08bf9e to e9b5a5e Compare October 22, 2026 22:20
@Mic92
Mic92 force-pushed the rstest branch 2 times, most recently from 45400d1 to 70e7921 Compare October 22, 2026 22:49
@zimbatm
zimbatm force-pushed the rstest branch 2 times, most recently from d8984ef to d0860b5 Compare October 23, 2026 21:08
Mic92 and others added 13 commits October 23, 2026 21:44
A loop over cases stops at the first failure and hides the rest. With
rstest each row is its own test. The classic tests keep their loops
because their rows share one nix-daemon.

Change-Id: I8e229b3fe64c3275825f052593733a364c598b26
rstest's #[files] makes one test per tests/lang file, so build.rs no
longer generates them. After adding a case on an incremental build,
touch tests/langtests.rs.

Change-Id: Ie6bd102eb9bda88babcb5cbeaaf3e124ad0e702f
lang_corpus parsed all files in one test. Now each file is its own
test, like the eval cases.

Change-Id: I2a031f06c22b15ceeafc512250ee17dac3800e34
Same change as for the integration tests. Loops over shared state,
like the cache sweeps and the IR cache fuzz loops, stay.

Change-Id: I059ea3ec6f3f79b5a4bf5e9efe04ec326e623e3e
Several functions were tested with one assert or one test per input.
As tables each input reports on its own.

Change-Id: Iba5426fc69767e392dd21e563052664ac0d47c87
The hash encoding, directory NAR and iets diff exit code tests ran the
same check on different inputs. The old test names are now case names.

Change-Id: I86de75b316fda3a5cd8728b5827535bc0fe554d1
fixture_tree() wrote to the shared temp dir under a pid and a tag that
callers had to keep unique, and never cleaned up. Now each test gets
its own TempDir.

Change-Id: Ia860f1d3fea5c648833551e0e99ed6e6118ad9e8
hermetic::iets() chose the home by thread name, so a command run from a
spawned thread got a shared home. The bin fixture owns a TempDir home
per test.

Change-Id: I7e45e9a1341f0db401f365a8bca8885286e25bb9
These used pid and tag names in the shared temp dir and mostly were not
cleaned up. In fetchurl one fixture now holds the file, its URL and
iets, so the helpers take one argument.

Change-Id: I2d088364177b7dcbee31a82428a82a45de763954
cli, pure and fetchurl each had the same text() helper and other tests
decoded output inline. Checks of an exact trailing newline compare the
bytes.

Change-Id: Ifb2db982fc8dc698ef9bb87d19b1cc99f0618b1b
The flake, git, ledger and lint tests each had a copy.

Change-Id: I3d8361de0447368d7d1e53b256a9309789cab333
spool and unpack each had one. The spool copy also writes a `..`
member name, so unpack uses it.

Change-Id: I14dd579ce1962a4aa343760b3f13eec54786214f
Both came in on main with hermetic::iets(), which the fixture replaced.

Assisted-by: Claude Code (claude-opus-5)
Change-Id: I2fd4992613539f6e1289bf443ea2b3ea2b928f67
@Mic92
Mic92 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 7c0b017 Oct 23, 2026
5 checks passed
@Mic92
Mic92 deleted the rstest branch October 23, 2026 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants