[Pkg-bitcoin-commits] [bitcoin] 26/126: [test] Add support for custom arguments to TestNodeCLI
Jonas Smedegaard
dr at jones.dk
Mon Nov 13 20:00:54 UTC 2017
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/0.15.1_dfsg-1
in repository bitcoin.
commit e0bfd28de28efb1ffa84e89d76c144824dae987f
Author: João Barbosa <joao.paulo.barbosa at gmail.com>
Date: Wed Sep 6 17:07:21 2017 +0100
[test] Add support for custom arguments to TestNodeCLI
Github-Pull: #11125
Rebased-From: 5c18a84b9a49e3f9dacf0502dbf7d5d755f38da6
---
test/functional/test_framework/test_node.py | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index f58a372..3630257 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -155,8 +155,16 @@ class TestNodeCLI():
"""Interface to bitcoin-cli for an individual node"""
def __init__(self, binary, datadir):
+ self.args = []
self.binary = binary
self.datadir = datadir
+ self.input = None
+
+ 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
def __getattr__(self, command):
def dispatcher(*args, **kwargs):
@@ -169,9 +177,9 @@ class TestNodeCLI():
pos_args = [str(arg) for arg in args]
named_args = [str(key) + "=" + str(value) for (key, value) in kwargs.items()]
assert not (pos_args and named_args), "Cannot use positional arguments and named arguments in the same bitcoin-cli call"
- p_args = [self.binary, "-datadir=" + self.datadir]
+ p_args = [self.binary, "-datadir=" + self.datadir] + self.args
if named_args:
p_args += ["-named"]
p_args += [command] + pos_args + named_args
- cli_output = subprocess.check_output(p_args, universal_newlines=True)
+ cli_output = subprocess.check_output(p_args, input=self.input, universal_newlines=True)
return json.loads(cli_output, parse_float=decimal.Decimal)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/bitcoin.git
More information about the Pkg-bitcoin-commits
mailing list