about summary refs log tree commit diff
path: root/nixos/lib/testing-python.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2021-02-09 12:02:35 +0100
committerRobert Hensing <robert@roberthensing.nl>2021-03-23 15:14:31 +0100
commitcda907d8952db00945bef17f473dec2c4e66d0a5 (patch)
tree44d0fbad95c055064160c870d9239be3d3b6e525 /nixos/lib/testing-python.nix
parent4787a38c707c36fd74e92abd6ad8ce0979f4a4f2 (diff)
nixosTest: fix meta.position
Diffstat (limited to 'nixos/lib/testing-python.nix')
-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 6192be1cd0532..2d80934ab9567 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
@@ -176,7 +183,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