all-tests: exclude passthru attributes from test discovery

discoverTests tries to discover some sort of internal function and tries to call
it with the arguments for that internal function. This poses an issue when you
want to expose some other functions (i.e. a parameterisation for a test) in
nixosTests.

This commit allows a test to pass through arbitrary values via `.passthru`
without them having discovery applied to them; including functions.
This commit is contained in:
Atemu 2023-08-06 15:40:10 +02:00
parent 18036c0be9
commit 6229f0bc8f

View file

@ -21,7 +21,7 @@ let
if isAttrs val if isAttrs val
then then
if hasAttr "test" val then callTest val if hasAttr "test" val then callTest val
else mapAttrs (n: s: discoverTests s) val else mapAttrs (n: s: if n == "passthru" then s else discoverTests s) val
else if isFunction val else if isFunction val
then then
# Tests based on make-test-python.nix will return the second lambda # Tests based on make-test-python.nix will return the second lambda