test_lightningd.py: don't fail if valgrind turned off.

eg:
test_routing_gossip (__main__.LightningDTests) ... ERROR

======================================================================
ERROR: test_routing_gossip (__main__.LightningDTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/test_lightningd.py", line 150, in tearDown
    err_count += self.printValgrindErrors(node)
  File "tests/test_lightningd.py", line 137, in printValgrindErrors
    errors, fname = self.getValgrindErrors(node)
  File "tests/test_lightningd.py", line 132, in getValgrindErrors
    with open(error_file, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/lightning-l106st0a/test_routing_gossip/lightning-1/valgrind-errors'

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-05-18 13:50:37 +09:30 committed by Christian Decker
parent 811e14ff66
commit 3d2f166364
1 changed files with 2 additions and 0 deletions

View File

@ -128,6 +128,8 @@ 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()