pytest: Remove any existing lightning-dirs before running

This was causing some issue when automatically rerunning tests on
travis.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2018-02-24 00:14:21 +01:00
parent da062df594
commit 330682abfe

View File

@ -8,6 +8,7 @@ import queue
import os
import random
import re
import shutil
import socket
import sqlite3
import stat
@ -107,6 +108,9 @@ class NodeFactory(object):
lightning_dir = os.path.join(
TEST_DIR, self.testname, "lightning-{}/".format(node_id))
if os.path.exists(lightning_dir):
shutil.rmtree(lightning_dir)
socket_path = os.path.join(lightning_dir, "lightning-rpc").format(node_id)
port = 16330 + node_id
daemon = utils.LightningD(lightning_dir, self.bitcoind.bitcoin_dir, port=port, random_hsm=random_hsm)