Skip to content

Commit a04121b

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26617: test: add extra_args to BitcoinTestFramework class
150340a test: remove unneeded extra_args code (josibake) 989a52e test: add extra_args to BTF class (josibake) Pull request description: ## problem If you try to add `extra_args` when using `TestShell`, you will get the following error: ```python >>> import sys >>> >>> sys.path.insert(0, "/home/josibake/bitcoin/test/functional") >>> >>> from test_framework.test_shell import TestShell >>> test = TestShell().setup(num_nodes=2, extra_args=[[],['-fallbackfee=0.0002']]) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/josibake/bitcoin/test/functional/test_framework/test_shell.py", line 41, in setup raise KeyError(key + " not a valid parameter key!") KeyError: 'extra_args not a valid parameter key!' >>> ``` ## solution add `self.extra_args = None` so that `extra_args` is recognized as a valid parameter to be passed to `BitcoinTestFramework` ```python >>> import sys >>> >>> sys.path.insert(0, "/home/josibake/bitcoin/test/functional") >>> >>> from test_framework.test_shell import TestShell >>> test = TestShell().setup(num_nodes=2, extra_args=[[],['-fallbackfee=0.0002']]) 2022-12-01T11:23:23.765000Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_sbwthbb_ ``` ACKs for top commit: willcl-ark: re-ACK 150340a Tree-SHA512: e6fa2a780a8f2d3472c322e8cdb00ec35cb220c3b4d6ca02291eb8b41c0d8676a635fbc79c6be80e3bb71d700a2501a4b73f762478f533ae453d492d449307bb
2 parents e334f7a + 150340a commit a04121b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def __init__(self):
9797
self.chain: str = 'regtest'
9898
self.setup_clean_chain: bool = False
9999
self.nodes: List[TestNode] = []
100+
self.extra_args = None
100101
self.network_thread = None
101102
self.rpc_timeout = 60 # Wait for up to 60 seconds for the RPC server to respond
102103
self.supports_cli = True
@@ -408,10 +409,7 @@ def setup_network(self):
408409

409410
def setup_nodes(self):
410411
"""Override this method to customize test node setup"""
411-
extra_args = [[]] * self.num_nodes
412-
if hasattr(self, "extra_args"):
413-
extra_args = self.extra_args
414-
self.add_nodes(self.num_nodes, extra_args)
412+
self.add_nodes(self.num_nodes, self.extra_args)
415413
self.start_nodes()
416414
if self._requires_wallet:
417415
self.import_deterministic_coinbase_privkeys()

0 commit comments

Comments
 (0)