aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/test_framework.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/test_framework/test_framework.py')
-rwxr-xr-xtest/functional/test_framework/test_framework.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index fa1503c6df..d88cccecd9 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -194,12 +194,6 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
help="set a random seed for deterministically reproducing a previous test run")
parser.add_argument('--timeout-factor', dest="timeout_factor", type=float, default=1.0, help='adjust test timeouts by a factor. Setting it to 0 disables all timeouts')
- group = parser.add_mutually_exclusive_group()
- group.add_argument("--descriptors", action='store_const', const=True,
- help="Run test using a descriptor wallet", dest='descriptors')
- group.add_argument("--legacy-wallet", action='store_const', const=False,
- help="Run test using legacy wallets", dest='descriptors')
-
self.add_options(parser)
# Running TestShell in a Jupyter notebook causes an additional -f argument
# To keep TestShell from failing with an "unrecognized argument" error, we add a dummy "-f" argument
@@ -212,7 +206,13 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
config.read_file(open(self.options.configfile))
self.config = config
- if self.options.descriptors is None:
+ if "descriptors" not in self.options:
+ # Wallet is not required by the test at all and the value of self.options.descriptors won't matter.
+ # It still needs to exist and be None in order for tests to work however.
+ # So set it to None to force -disablewallet, because the wallet is not needed.
+ self.options.descriptors = None
+ elif self.options.descriptors is None:
+ # Some wallet is either required or optionally used by the test.
# Prefer BDB unless it isn't available
if self.is_bdb_compiled():
self.options.descriptors = False
@@ -221,6 +221,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
else:
# If neither are compiled, tests requiring a wallet will be skipped and the value of self.options.descriptors won't matter
# It still needs to exist and be None in order for tests to work however.
+ # So set it to None, which will also set -disablewallet.
self.options.descriptors = None
PortSeed.n = self.options.port_seed
@@ -446,6 +447,15 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
# Public helper methods. These can be accessed by the subclass test scripts.
+ def add_wallet_options(self, parser, *, descriptors=True, legacy=True):
+ group = parser.add_mutually_exclusive_group()
+ if descriptors:
+ group.add_argument("--descriptors", action='store_const', const=True,
+ help="Run test using a descriptor wallet", dest='descriptors')
+ if legacy:
+ group.add_argument("--legacy-wallet", action='store_const', const=False,
+ 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):
"""Instantiate TestNode objects.