Skip to content

Commit ca9085a

Browse files
ryanofskyjnewbery
authored andcommitted
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.
1 parent fcfb952 commit ca9085a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/functional/test_framework/test_node.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,10 @@ def __init__(self, binary, datadir):
203203

204204
def __call__(self, *args, input=None):
205205
# TestNodeCLI is callable with bitcoin-cli command-line args
206-
self.args = [str(arg) for arg in args]
207-
self.input = input
208-
return self
206+
cli = TestNodeCLI(self.binary, self.datadir)
207+
cli.args = [str(arg) for arg in args]
208+
cli.input = input
209+
return cli
209210

210211
def __getattr__(self, command):
211212
def dispatcher(*args, **kwargs):

0 commit comments

Comments
 (0)