From bbeb44faac4b849c169ff02eaa2a4afa3908e278 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Fri, 4 May 2018 18:27:07 +0200 Subject: [PATCH] pytest: Make the directory of the NodeFactory configurable Signed-off-by: Christian Decker --- tests/test_lightningd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 7a2e96344..12506cc54 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -95,12 +95,17 @@ def teardown_bitcoind(): class NodeFactory(object): """A factory to setup and start `lightningd` daemons. """ - def __init__(self, testname, bitcoind, executor): + def __init__(self, testname, bitcoind, executor, directory=None): self.testname = testname self.next_id = 1 self.nodes = [] self.executor = executor self.bitcoind = bitcoind + if directory is not None: + self.directory = directory + else: + self.directory = os.path.join(TEST_DIR, testname) + self.lock = threading.Lock() def split_options(self, opts): """Split node options from cli options @@ -148,7 +153,7 @@ class NodeFactory(object): self.next_id += 1 lightning_dir = os.path.join( - TEST_DIR, self.testname, "lightning-{}/".format(node_id)) + self.directory, "lightning-{}/".format(node_id)) if os.path.exists(lightning_dir): shutil.rmtree(lightning_dir)