tests.overriding: refactor and allow non-bool expected value#456848
tests.overriding: refactor and allow non-bool expected value#456848MattSturgeon merged 2 commits intoNixOS:masterfrom
Conversation
da226c5 to
031e352
Compare
031e352 to
1e22aeb
Compare
| passthru = { inherit tests; }; | ||
| passthru = { | ||
| inherit tests; | ||
| failures = lib.runTests (finalAttrs.passthru.tests // { tests = lib.attrNames tests; }); |
There was a problem hiding this comment.
I don't understand a) why we need two test frameworks here (this derivation and runTests) and b) why this is called failures.
If we include this passthru, isn't it just an alternative to the below, that also attempts to print the expr and expected results using toPretty?
There was a problem hiding this comment.
isn't it just an alternative to the below, that also attempts to print the
exprandexpectedresults usingtoPretty?
IIUC, the design of tests.overriding avoids context from test cases, which would break if we print expr and expected in buildCommand.
tests.overriding is essentially a collection of evaluation tests for build helpers. But we need it as a package test, and therefore the package part. The name failures comes from a search across Nixpkgs with keyword "lib.runTests", and 3 in 5 result are failures = lib.runTests {.
I added it as an alternative to building the package (nix eval -f . tests.overriding.failures), which hopefully ease staging change testing. Still, having two test frameworks is kinda redundant, and we could just tell people to look at tests.overriding.tests.
There was a problem hiding this comment.
If there's precedent for failures = runTests elsewhere, then I'm fine with having it. It just felt (feels) like a bit of an odd pattern.
c4d97a4 to
fea9839
Compare
MattSturgeon
left a comment
There was a problem hiding this comment.
One nit, otherwise LGTM
Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
57ad481 to
ffca1c4
Compare
MattSturgeon
left a comment
There was a problem hiding this comment.
I squashed 57ad481a13faac26777246b9bd02c1e0dd48ab20. Hopefully the rebase also helps with the weird CI error we were seeing.
|
This comment has been minimized.
This comment has been minimized.
|
Ah! It is already in release-25.11. |
exprandexpectedat evaluation time, instead of comparing their string-interpolation at build time.testResultsinstead of dumping all the values intobuildCommand.passthru.tests, addpassthru.failuresforlib.runTest-generated list of failed tests, similar tolib/tests/misc.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.