mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-03 01:09:14 +01:00
test: Remove wallet option from non-wallet tests
Review note: The changes are complete, because self.options.descriptors is set to None in parse_args (test_framework.py). A value of None implies -disablewallet, see the previous commit. So if a call to add_wallet_options is missing, it will lead to a test failure when the wallet is compiled in.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user