From fa10f193b54650b3071bc7ee2d90fcfe40a16dc9 Mon Sep 17 00:00:00 2001 From: MacroFake Date: Tue, 15 Nov 2022 10:05:02 +0100 Subject: [PATCH] test: Set default in add_wallet_options if only one type can be chosen --- test/functional/test_framework/test_framework.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index d88cccecd96..1140d26f4fe 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -449,11 +449,15 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): def add_wallet_options(self, parser, *, descriptors=True, legacy=True): group = parser.add_mutually_exclusive_group() + kwargs = {} + if descriptors + legacy == 1: + # If only one type can be chosen, set it as default + kwargs["default"] = descriptors if descriptors: - group.add_argument("--descriptors", action='store_const', const=True, + group.add_argument("--descriptors", action='store_const', const=True, **kwargs, help="Run test using a descriptor wallet", dest='descriptors') if legacy: - group.add_argument("--legacy-wallet", action='store_const', const=False, + group.add_argument("--legacy-wallet", action='store_const', const=False, **kwargs, help="Run test using legacy wallets", dest='descriptors') def add_nodes(self, num_nodes: int, extra_args=None, *, rpchost=None, binary=None, binary_cli=None, versions=None):