pytest: Make sure to clean up all lightningds after failures

A failed returncode check could result in the cleanup for other
lightningds to be skipped. Now make sure to cleanup all and then
rethrow an exception that contains all returncodes.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2017-09-28 17:52:48 +02:00
committed by Rusty Russell
parent 11eaabdbe6
commit c1f4c86589

View File

@@ -125,8 +125,16 @@ class NodeFactory(object):
return node
def killall(self):
rcs = []
failed = False
for n in self.nodes:
n.stop()
try:
n.stop()
except:
failed = True
rcs.append(n.daemon.proc.returncode)
if failed:
raise Exception("At least one lightning exited with non-zero return code: {}".format(rcs))
class BaseLightningDTests(unittest.TestCase):