From 80486a66698c6c1818422b9ddabf9b0f64f4cf25 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 12 May 2017 12:08:14 +0200 Subject: [PATCH] pytest: Do not check for valgrind errors if disabled Checking for valgrind errors if we disabled valgrind will kill the teardown, so don't! --- tests/test_lightningd.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 91db45fbe..7c841988f 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -128,8 +128,6 @@ class BaseLightningDTests(unittest.TestCase): self.node_factory = NodeFactory(self, self.executor) def getValgrindErrors(self, node): - if not VALGRIND: - return None, None error_file = '{}valgrind-errors'.format(node.daemon.lightning_dir) with open(error_file, 'r') as f: errors = f.read().strip() @@ -147,12 +145,15 @@ class BaseLightningDTests(unittest.TestCase): def tearDown(self): self.node_factory.killall() self.executor.shutdown(wait=False) - err_count = 0 - for node in self.node_factory.nodes: - err_count += self.printValgrindErrors(node) - if err_count: - raise ValueError( - "{} nodes reported valgrind errors".format(err_count)) + + # Do not check for valgrind error files if it is disabled + if VALGRIND: + err_count = 0 + for node in self.node_factory.nodes: + err_count += self.printValgrindErrors(node) + if err_count: + raise ValueError( + "{} nodes reported valgrind errors".format(err_count)) class LightningDTests(BaseLightningDTests): def connect(self):