aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-12-20 18:41:12 -0500
committerJohn Newbery <john@johnnewbery.com>2018-01-08 15:17:14 -0500
commitca9085afc53eb20c1fc745ae469e9587a05b7f24 (patch)
tree6a24a3722451db06f974314923dc9d3ffa2893c1
parentfcfb952bca922682e61c77e59a59f4e7fa6619c7 (diff)
downloadbitcoin-ca9085afc53eb20c1fc745ae469e9587a05b7f24.tar.xz
Prevent TestNodeCLI.args mixups
Change TestNodeCLI.__call__() to return a new instance instead of modifying the existing instance. This way, it's possible to create different cli objects that have their own options (for example -rpcwallet options to connect to different wallets), and options set for a single call (`node.cli(options).method(args)`) will no longer leak into future calls.
-rwxr-xr-xtest/functional/test_framework/test_node.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 66f99f3011..1723f50eba 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -203,9 +203,10 @@ class TestNodeCLI():
def __call__(self, *args, input=None):
# TestNodeCLI is callable with bitcoin-cli command-line args
- self.args = [str(arg) for arg in args]
- self.input = input
- return self
+ cli = TestNodeCLI(self.binary, self.datadir)
+ cli.args = [str(arg) for arg in args]
+ cli.input = input
+ return cli
def __getattr__(self, command):
def dispatcher(*args, **kwargs):