summary refs log tree commit diff
path: root/nixos/lib
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2021-05-03 11:50:57 +0200
committerGitHub <noreply@github.com>2021-05-03 11:50:57 +0200
commitb2f44e9aebbfec7fceea8bde3a6153133305e66c (patch)
tree110de40f8f25c2d32d5e68cdcf88bce550014eea /nixos/lib
parent2eddff5480cbf7402076ed52754e8e4c9acc014f (diff)
parentcda907d8952db00945bef17f473dec2c4e66d0a5 (diff)
downloadnixpkgs-b2f44e9aebbfec7fceea8bde3a6153133305e66c.tar
nixpkgs-b2f44e9aebbfec7fceea8bde3a6153133305e66c.tar.gz
nixpkgs-b2f44e9aebbfec7fceea8bde3a6153133305e66c.tar.bz2
nixpkgs-b2f44e9aebbfec7fceea8bde3a6153133305e66c.tar.lz
nixpkgs-b2f44e9aebbfec7fceea8bde3a6153133305e66c.tar.xz
nixpkgs-b2f44e9aebbfec7fceea8bde3a6153133305e66c.tar.zst
nixpkgs-b2f44e9aebbfec7fceea8bde3a6153133305e66c.zip
Merge pull request #112504 from hercules-ci/fix-nixosTest-meta-position
nixosTest: fix meta.position
Diffstat (limited to 'nixos/lib')
-rw-r--r--nixos/lib/testing-python.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index c7e45f55ce1..cbe90ff4cbf 100644
--- a/nixos/lib/testing-python.nix
+++ b/nixos/lib/testing-python.nix
@@ -55,7 +55,7 @@ rec {
 
   # Run an automated test suite in the given virtual network.
   # `driver' is the script that runs the network.
-  runTests = driver:
+  runTests = { driver, pos }:
     stdenv.mkDerivation {
       name = "vm-test-run-${driver.testName}";
 
@@ -69,6 +69,8 @@ rec {
         '';
 
       passthru = driver.passthru;
+
+      inherit pos;
     };
 
 
@@ -79,6 +81,11 @@ rec {
       # Skip linting (mainly intended for faster dev cycles)
     , skipLint ? false
     , passthru ? {}
+    , # For meta.position
+      pos ? # position used in error messages and for meta.position
+        (if t.meta.description or null != null
+          then builtins.unsafeGetAttrPos "description" t.meta
+          else builtins.unsafeGetAttrPos "testScript" t)
     , ...
     } @ t:
     let
@@ -174,7 +181,7 @@ rec {
       driver = mkDriver null;
       driverInteractive = mkDriver pkgs.qemu;
 
-      test = passMeta (runTests driver);
+      test = passMeta (runTests { inherit driver pos; });
 
       nodeNames = builtins.attrNames driver.nodes;
       invalidNodeNames = lib.filter