aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/test_framework.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-07-11 13:14:18 -0400
committerJohn Newbery <john@johnnewbery.com>2018-01-08 17:35:27 -0500
commitf6ade9ce1a679a026c84e5baa9f8595fa2be78a5 (patch)
tree547fff7483a8857f9cec0d1bbeb7c14903be741d /test/functional/test_framework/test_framework.py
parentff9a363ff70e1b72a1283098e69bbe14d1c16bcc (diff)
downloadbitcoin-f6ade9ce1a679a026c84e5baa9f8595fa2be78a5.tar.xz
[tests] allow tests to be run with --usecli
test_framework accepts a new --usecli parameter. Running the test with this parameter will cause all RPCs to be sent through bitcoin-cli rather than directly over http. By default, individual test cases do not support --usecli, and self.supports_cli must be set to True in the set_test_params method. We can make supports_cli default to True in future once we know which tests will fail with use_cli.
Diffstat (limited to 'test/functional/test_framework/test_framework.py')
-rwxr-xr-xtest/functional/test_framework/test_framework.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index e42f3e60c2..5d4f8e6720 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -62,6 +62,7 @@ class BitcoinTestFramework():
self.setup_clean_chain = False
self.nodes = []
self.mocktime = 0
+ self.supports_cli = False
self.set_test_params()
assert hasattr(self, "num_nodes"), "Test must set self.num_nodes in set_test_params()"
@@ -91,6 +92,8 @@ class BitcoinTestFramework():
help="Location of the test framework config file")
parser.add_option("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
help="Attach a python debugger if test fails")
+ parser.add_option("--usecli", dest="usecli", default=False, action="store_true",
+ help="use bitcoin-cli instead of RPC for all commands")
self.add_options(parser)
(self.options, self.args) = parser.parse_args()
@@ -113,6 +116,8 @@ class BitcoinTestFramework():
success = TestStatus.FAILED
try:
+ if self.options.usecli and not self.supports_cli:
+ raise SkipTest("--usecli specified but test does not support using CLI")
self.setup_chain()
self.setup_network()
self.run_test()
@@ -213,7 +218,7 @@ class BitcoinTestFramework():
assert_equal(len(extra_args), num_nodes)
assert_equal(len(binary), num_nodes)
for i in range(num_nodes):
- self.nodes.append(TestNode(i, self.options.tmpdir, extra_args[i], rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir))
+ self.nodes.append(TestNode(i, self.options.tmpdir, extra_args[i], rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, use_cli=self.options.usecli))
def start_node(self, i, extra_args=None, stderr=None):
"""Start a bitcoind"""