Skip to content

Commit b53573e

Browse files
author
MarcoFalke
committed
Merge #14951: Revert "tests: Support calling add_nodes more than once"
fa4b8c9 test: add_nodes can only be called once after set_test_params (MarcoFalke) faa8311 Revert "tests: Support calling add_nodes more than once" (MarcoFalke) Pull request description: Writing tests should be straightforward and with little side-effects as possible. I don't see how this is needed and can not be achieved with `self.num_nodes` (and `self.extra_args` et al.) Tree-SHA512: 83a67f2cba9d97e21d80847ff405a4633fcb0d5674486efa57ee1813e46efe8709ae0fb462b8339a01ebeca5c4f2d29ecb1807d648b8fd9ee8ce336b08d580a8
2 parents 7a30e0f + fa4b8c9 commit b53573e

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ def run_test(self):
281281
# Public helper methods. These can be accessed by the subclass test scripts.
282282

283283
def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None):
284-
"""Instantiate TestNode objects"""
284+
"""Instantiate TestNode objects.
285+
286+
Should only be called once after the nodes have been specified in
287+
set_test_params()."""
285288
if self.bind_to_localhost_only:
286289
extra_confs = [["bind=127.0.0.1"]] * num_nodes
287290
else:
@@ -294,8 +297,19 @@ def add_nodes(self, num_nodes, extra_args=None, *, rpchost=None, binary=None):
294297
assert_equal(len(extra_args), num_nodes)
295298
assert_equal(len(binary), num_nodes)
296299
for i in range(num_nodes):
297-
numnode = len(self.nodes)
298-
self.nodes.append(TestNode(numnode, get_datadir_path(self.options.tmpdir, numnode), rpchost=rpchost, timewait=self.rpc_timewait, bitcoind=binary[i], bitcoin_cli=self.options.bitcoincli, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, extra_conf=extra_confs[i], extra_args=extra_args[i], use_cli=self.options.usecli))
300+
self.nodes.append(TestNode(
301+
i,
302+
get_datadir_path(self.options.tmpdir, i),
303+
rpchost=rpchost,
304+
timewait=self.rpc_timewait,
305+
bitcoind=binary[i],
306+
bitcoin_cli=self.options.bitcoincli,
307+
mocktime=self.mocktime,
308+
coverage_dir=self.options.coveragedir,
309+
extra_conf=extra_confs[i],
310+
extra_args=extra_args[i],
311+
use_cli=self.options.usecli,
312+
))
299313

300314
def start_node(self, i, *args, **kwargs):
301315
"""Start a bitcoind"""

0 commit comments

Comments
 (0)