Skip to content

Commit 5332bce

Browse files
achow101vijaydasmp
authored andcommitted
Merge bitcoin#26480: test: Remove wallet option from non-wallet tests
fa10f19 test: Set default in add_wallet_options if only one type can be chosen (MacroFake) 555519d test: Remove wallet option from non-wallet tests (MacroFake) fac8d59 test: Set -disablewallet when no wallet has been compiled (MacroFake) fa68937 test: Make requires_wallet private (MacroFake) Pull request description: The tests have several issues: * Some tests that are wallet-type specific offer the option to run the test with the incompatible type For example, `wallet_dump.py` offers `--descriptors` and on current master fails with `JSONRPCException: Invalid public key`. After the changes here, it fails with a clear error: `unrecognized arguments: --descriptors`. * Tests that don't use the wallet at all offer the option to run it with a wallet type. This is confusing and wastes developers time if they are "tricked" into running the test for both wallet types, even though no wallet code is executed at all. For example, `feature_addrman.py` will happily accept and run with `--descriptors` or `--legacy-wallet`. After the changes here, it no longer silently ignores the flag, but reports a clear error: `unrecognized arguments`. ACKs for top commit: achow101: ACK fa10f19 Tree-SHA512: a5784da7305f4ec58c0013f433289000d94fc3d434b00fc329ffa37b812e2cd1da0071e34c3462bf79d904808564f2ae6d3d582f6b86b26215f9b07391b58460
1 parent 57992cf commit 5332bce

67 files changed

Lines changed: 218 additions & 22 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/functional/example_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ class ExampleTest(BitcoinTestFramework):
7979
# Override the set_test_params(), skip_test_if_missing_module(), add_options(), setup_chain(), setup_network()
8080
# and setup_nodes() methods to customize the test setup as required.
8181

82+
def add_options(self, parser):
83+
self.add_wallet_options(parser)
84+
8285
def set_test_params(self):
8386
"""Override test parameters for your individual test.
8487

test/functional/feature_backwards_compatibility.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131

3232

3333
class BackwardsCompatibilityTest(BitcoinTestFramework):
34+
def add_options(self, parser):
35+
self.add_wallet_options(parser)
36+
3437
def set_test_params(self):
3538
self.setup_clean_chain = True
3639
self.num_nodes = 8

test/functional/feature_bip68_sequence.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
NOT_FINAL_ERROR = "non-BIP68-final"
4242

4343
class BIP68Test(BitcoinTestFramework):
44+
def add_options(self, parser):
45+
self.add_wallet_options(parser)
46+
4447
def set_test_params(self):
4548
self.num_nodes = 2
4649
self.extra_args = [

test/functional/feature_config_args.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313

1414
class ConfArgsTest(BitcoinTestFramework):
15+
def add_options(self, parser):
16+
self.add_wallet_options(parser)
17+
1518
def set_test_params(self):
1619
self.setup_clean_chain = True
1720
self.num_nodes = 1

test/functional/feature_filelock.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414

1515
class FilelockTest(BitcoinTestFramework):
16+
def add_options(self, parser):
17+
self.add_wallet_options(parser)
18+
1619
def set_test_params(self):
1720
self.setup_clean_chain = True
1821
self.num_nodes = 2

test/functional/feature_init.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class InitStressTest(BitcoinTestFramework):
1919
subsequent starts.
2020
"""
2121

22+
def add_options(self, parser):
23+
self.add_wallet_options(parser)
24+
2225
def set_test_params(self):
2326
self.setup_clean_chain = False
2427
self.num_nodes = 1

test/functional/feature_notifications.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def notify_outputname(walletname, txid):
2626

2727

2828
class NotificationsTest(DashTestFramework):
29+
def add_options(self, parser):
30+
self.add_wallet_options(parser)
2931
def set_test_params(self):
3032
self.set_dash_test_params(6, 4)
3133

test/functional/feature_pruning.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ def calc_usage(blockdir):
8888
return sum(os.path.getsize(blockdir + f) for f in os.listdir(blockdir) if os.path.isfile(os.path.join(blockdir, f))) / (1024. * 1024.)
8989

9090
class PruneTest(BitcoinTestFramework):
91+
def add_options(self, parser):
92+
self.add_wallet_options(parser)
93+
9194
def set_test_params(self):
9295
self.setup_clean_chain = True
9396
self.num_nodes = 6

test/functional/interface_bitcoin_cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ def cli_get_info_string_to_dict(cli_get_info_string):
6666

6767

6868
class TestBitcoinCli(BitcoinTestFramework):
69+
def add_options(self, parser):
70+
self.add_wallet_options(parser)
71+
6972
def set_test_params(self):
7073
self.setup_clean_chain = True
7174
self.num_nodes = 1
72-
if self.is_specified_wallet_compiled():
73-
self.requires_wallet = True
7475

7576
def skip_test_if_missing_module(self):
7677
self.skip_if_no_cli()
@@ -123,6 +124,7 @@ def run_test(self):
123124

124125
self.log.info("Test -getinfo returns expected network and blockchain info")
125126
if self.is_specified_wallet_compiled():
127+
self.import_deterministic_coinbase_privkeys()
126128
self.nodes[0].encryptwallet(password)
127129
cli_get_info_string = self.nodes[0].cli('-getinfo').send_cli()
128130
cli_get_info = cli_get_info_string_to_dict(cli_get_info_string)

test/functional/interface_usdt_coinselection.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@
9797

9898

9999
class CoinSelectionTracepointTest(BitcoinTestFramework):
100+
def add_options(self, parser):
101+
self.add_wallet_options(parser)
102+
100103
def set_test_params(self):
101104
self.num_nodes = 1
102105
self.setup_clean_chain = True

0 commit comments

Comments
 (0)