Skip to content

Commit fa10f19

Browse files
author
MacroFake
committed
test: Set default in add_wallet_options if only one type can be chosen
1 parent 555519d commit fa10f19

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,15 @@ def run_test(self):
449449

450450
def add_wallet_options(self, parser, *, descriptors=True, legacy=True):
451451
group = parser.add_mutually_exclusive_group()
452+
kwargs = {}
453+
if descriptors + legacy == 1:
454+
# If only one type can be chosen, set it as default
455+
kwargs["default"] = descriptors
452456
if descriptors:
453-
group.add_argument("--descriptors", action='store_const', const=True,
457+
group.add_argument("--descriptors", action='store_const', const=True, **kwargs,
454458
help="Run test using a descriptor wallet", dest='descriptors')
455459
if legacy:
456-
group.add_argument("--legacy-wallet", action='store_const', const=False,
460+
group.add_argument("--legacy-wallet", action='store_const', const=False, **kwargs,
457461
help="Run test using legacy wallets", dest='descriptors')
458462

459463
def add_nodes(self, num_nodes: int, extra_args=None, *, rpchost=None, binary=None, binary_cli=None, versions=None):

0 commit comments

Comments
 (0)