Merge pull request #73189 from flokli/python-tests-return-multiple
nixos/tests: fix succeed() with multiple commands
This commit is contained in:
commit
556a169f14
@ -381,14 +381,16 @@ class Machine:
|
|||||||
|
|
||||||
def succeed(self, *commands):
|
def succeed(self, *commands):
|
||||||
"""Execute each command and check that it succeeds."""
|
"""Execute each command and check that it succeeds."""
|
||||||
|
output = ""
|
||||||
for command in commands:
|
for command in commands:
|
||||||
with self.nested("must succeed: {}".format(command)):
|
with self.nested("must succeed: {}".format(command)):
|
||||||
status, output = self.execute(command)
|
(status, out) = self.execute(command)
|
||||||
if status != 0:
|
if status != 0:
|
||||||
self.log("output: {}".format(output))
|
self.log("output: {}".format(out))
|
||||||
raise Exception(
|
raise Exception(
|
||||||
"command `{}` failed (exit code {})".format(command, status)
|
"command `{}` failed (exit code {})".format(command, status)
|
||||||
)
|
)
|
||||||
|
output += out
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def fail(self, *commands):
|
def fail(self, *commands):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user