summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2020-08-21 21:28:24 +0200
committerJanne Heß <janne@hess.ooo>2020-08-21 21:28:24 +0200
commitff03800d3bdcea31d21e624680e3ee34cad442aa (patch)
treed096f5096811fe40a83652cccbca83bb2f423989 /nixos
parenta02b4af726ef0a247932f90edc0a691eff8799f5 (diff)
downloadnixpkgs-ff03800d3bdcea31d21e624680e3ee34cad442aa.tar
nixpkgs-ff03800d3bdcea31d21e624680e3ee34cad442aa.tar.gz
nixpkgs-ff03800d3bdcea31d21e624680e3ee34cad442aa.tar.bz2
nixpkgs-ff03800d3bdcea31d21e624680e3ee34cad442aa.tar.lz
nixpkgs-ff03800d3bdcea31d21e624680e3ee34cad442aa.tar.xz
nixpkgs-ff03800d3bdcea31d21e624680e3ee34cad442aa.tar.zst
nixpkgs-ff03800d3bdcea31d21e624680e3ee34cad442aa.zip
nixos/testing: Fix fail() function
The docs say this behaves as succeed(), but it does not return stdout as
succeed() does. This fixes that behaviour
Diffstat (limited to 'nixos')
-rw-r--r--nixos/lib/test-driver/test-driver.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/nixos/lib/test-driver/test-driver.py b/nixos/lib/test-driver/test-driver.py
index 7b8d5803aa5..f4e2bb6100f 100644
--- a/nixos/lib/test-driver/test-driver.py
+++ b/nixos/lib/test-driver/test-driver.py
@@ -424,15 +424,18 @@ class Machine:
                 output += out
         return output
 
-    def fail(self, *commands: str) -> None:
+    def fail(self, *commands: str) -> str:
         """Execute each command and check that it fails."""
+        output = ""
         for command in commands:
             with self.nested("must fail: {}".format(command)):
-                status, output = self.execute(command)
+                (status, out) = self.execute(command)
                 if status == 0:
                     raise Exception(
                         "command `{}` unexpectedly succeeded".format(command)
                     )
+                output += out
+        return output
 
     def wait_until_succeeds(self, command: str) -> str:
         """Wait until a command returns success and return its output.