mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
Merge bitcoin/bitcoin#26617: test: add extra_args to BitcoinTestFramework class
150340aeac
test: remove unneeded extra_args code (josibake)989a52e0a5
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-ACK150340aeac
Tree-SHA512: e6fa2a780a8f2d3472c322e8cdb00ec35cb220c3b4d6ca02291eb8b41c0d8676a635fbc79c6be80e3bb71d700a2501a4b73f762478f533ae453d492d449307bb
This commit is contained in:
commit
a04121bdf9
1 changed files with 2 additions and 4 deletions
|
@ -97,6 +97,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||||
self.chain: str = 'regtest'
|
self.chain: str = 'regtest'
|
||||||
self.setup_clean_chain: bool = False
|
self.setup_clean_chain: bool = False
|
||||||
self.nodes: List[TestNode] = []
|
self.nodes: List[TestNode] = []
|
||||||
|
self.extra_args = None
|
||||||
self.network_thread = None
|
self.network_thread = None
|
||||||
self.rpc_timeout = 60 # Wait for up to 60 seconds for the RPC server to respond
|
self.rpc_timeout = 60 # Wait for up to 60 seconds for the RPC server to respond
|
||||||
self.supports_cli = True
|
self.supports_cli = True
|
||||||
|
@ -408,10 +409,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
||||||
|
|
||||||
def setup_nodes(self):
|
def setup_nodes(self):
|
||||||
"""Override this method to customize test node setup"""
|
"""Override this method to customize test node setup"""
|
||||||
extra_args = [[]] * self.num_nodes
|
self.add_nodes(self.num_nodes, self.extra_args)
|
||||||
if hasattr(self, "extra_args"):
|
|
||||||
extra_args = self.extra_args
|
|
||||||
self.add_nodes(self.num_nodes, extra_args)
|
|
||||||
self.start_nodes()
|
self.start_nodes()
|
||||||
if self._requires_wallet:
|
if self._requires_wallet:
|
||||||
self.import_deterministic_coinbase_privkeys()
|
self.import_deterministic_coinbase_privkeys()
|
||||||
|
|
Loading…
Add table
Reference in a new issue