From 3b096627683b631aa4722137cc06dbb13f9aafee Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 6 Apr 2020 11:41:46 +0200 Subject: [PATCH] pyln: Allow non-empty directory when creating node in node_factory So far we've always cleared the node directory when provisioning the node, but while testing some plugins we noticed that pre-generating some files in that directory is useful. This just adds yet another flag to `get_node` that disables deleting any existing node directory. --- contrib/pyln-testing/pyln/testing/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/pyln-testing/pyln/testing/utils.py b/contrib/pyln-testing/pyln/testing/utils.py index fb4172a69..72cbf4481 100644 --- a/contrib/pyln-testing/pyln/testing/utils.py +++ b/contrib/pyln-testing/pyln/testing/utils.py @@ -1011,7 +1011,8 @@ class NodeFactory(object): def get_node(self, node_id=None, options=None, dbfile=None, feerates=(15000, 11000, 7500, 3750), start=True, - wait_for_bitcoind_sync=True, expect_fail=False, **kwargs): + wait_for_bitcoind_sync=True, expect_fail=False, + cleandir=True, **kwargs): node_id = self.get_node_id() if not node_id else node_id port = self.get_next_port() @@ -1019,7 +1020,7 @@ class NodeFactory(object): lightning_dir = os.path.join( self.directory, "lightning-{}/".format(node_id)) - if os.path.exists(lightning_dir): + if cleandir and os.path.exists(lightning_dir): shutil.rmtree(lightning_dir) # Get the DB backend DSN we should be using for this test and this