summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRobert Hensing2022-06-25 21:26:50 +0200
committerRobert Hensing2022-09-24 17:38:09 +0100
commite77913a680bc9e7bfd2c93047ecfd6697e2402d7 (patch)
tree9543095ed816ccf0be7a4f1d79534cd1dea1e918 /nixos
parent9886db059a822f9bc1f8fbdacfd1ca1938fe9ebf (diff)
nixos/all-tests.nix: Invoke tests based on make-test-python.nix
Diffstat (limited to 'nixos')
-rw-r--r--nixos/tests/all-tests.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 62e05fcf2b1e..21e75561964b 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -18,9 +18,18 @@ with pkgs.lib;
 
 let
   discoverTests = val:
-    if !isAttrs val then val
-    else if hasAttr "test" val then callTest val
-    else mapAttrs (n: s: discoverTests s) val;
+    if isAttrs val
+    then
+      if hasAttr "test" val then callTest val
+      else mapAttrs (n: s: discoverTests s) val
+    else if isFunction val
+      then
+        # Tests based on make-test-python.nix will return the second lambda
+        # in that file, which are then forwarded to the test definition
+        # following the `import make-test-python.nix` expression
+        # (if it is a function).
+        discoverTests (val { inherit system pkgs; })
+      else val;
   handleTest = path: args:
     discoverTests (import path ({ inherit system pkgs; } // args));
   handleTestOn = systems: path: args: