From 54d28722baeac84950bbe6da1d315b9202012259 Mon Sep 17 00:00:00 2001 From: Martin Zumsande Date: Fri, 18 Apr 2025 17:41:12 -0400 Subject: [PATCH] test: Don't send empty named args with cli If python passed None for an optional (i.e. 'null' is sent), this will lead to the arg being interpreted as not provided by bitcoind - except for string args, for which the arg is interpreted as as 'null' string. Bypass this by not sending named args to bitcoin-cli - so that the default value will actually be used. Also drops an unnecessary str() conversion, kwargs keys are always strings. --- test/functional/test_framework/test_node.py | 2 +- test/functional/wallet_address_types.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index af101a58043..57b4b8c3093 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -918,7 +918,7 @@ class TestNodeCLI(): def send_cli(self, clicommand=None, *args, **kwargs): """Run bitcoin-cli command. Deserializes returned string as python object.""" pos_args = [arg_to_cli(arg) for arg in args] - named_args = [str(key) + "=" + arg_to_cli(value) for (key, value) in kwargs.items()] + named_args = [key + "=" + arg_to_cli(value) for (key, value) in kwargs.items() if value is not None] p_args = self.binaries.rpc_argv() + [f"-datadir={self.datadir}"] + self.options if named_args: p_args += ["-named"] diff --git a/test/functional/wallet_address_types.py b/test/functional/wallet_address_types.py index cfb8f926f00..7f6cf73d9af 100755 --- a/test/functional/wallet_address_types.py +++ b/test/functional/wallet_address_types.py @@ -78,7 +78,6 @@ class AddressTypeTest(BitcoinTestFramework): ] # whitelist peers to speed up tx relay / mempool sync self.noban_tx_relay = True - self.supports_cli = False def skip_test_if_missing_module(self): self.skip_if_no_wallet()