nit: not tested, but symlink-specific setup and checks could be skipped when symlink creation isnβt supported.
0 def test_mixed_wallets(self, node):
1 self.log.info("Test mixed wallets")
2- # create symlink to verify wallet directory path can be referenced
3- # through symlink
4- os.mkdir(wallet_dir(node, 'w7'))
5- os.symlink('w7', wallet_dir(node, 'w7_symlink'))
6-
7 if self.check_symlinks:
8+ # Create symlink to verify wallet directory path can be referenced through symlink.
9+ os.mkdir(wallet_dir(node, 'w7'))
10- os.mkdir(wallet_dir(node, 'w7'))
11- os.symlink('w7', wallet_dir(node, 'w7_symlink'))
12-
13 if self.check_symlinks:
14+ # Create symlink to verify wallet directory path can be referenced through symlink.
15+ os.mkdir(wallet_dir(node, 'w7'))
16+ os.symlink('w7', wallet_dir(node, 'w7_symlink'))
17 os.symlink('..', wallet_dir(node, 'recursive_dir_symlink'))
18
19 # rename wallet.dat to make sure plain wallet file paths (as opposed to
20@@ -153,12 +147,15 @@ class MultiWalletTest(BitcoinTestFramework):
21 # w - to verify wallet name matching works when one wallet path is prefix of another
22 # sub/w5 - to verify relative wallet path is created correctly
23 # extern/w6 - to verify absolute wallet path is created correctly
24- # w7_symlink - to verify symlinked wallet path is initialized correctly
25+ # w7_symlink - to verify symlinked wallet path is initialized correctly (symlink-capable platforms only)
26 # w8 - to verify existing wallet file is loaded correctly. Not tested for SQLite wallets as this is a deprecated BDB behavior.
27 # '' - to verify default wallet file is created correctly
28- to_create = ['w1', 'w2', 'w3', 'w', 'sub/w5', 'w7_symlink']
29+ to_create = ['w1', 'w2', 'w3', 'w', 'sub/w5']
30+ if self.check_symlinks:
31+ to_create.append('w7_symlink')
32 in_wallet_dir = [w.replace('/', os.path.sep) for w in to_create] # Wallets in the wallet dir
33- in_wallet_dir.append('w7') # w7 is not loaded or created, but will be listed by listwalletdir because w7_symlink
34+ if self.check_symlinks:
35+ in_wallet_dir.append('w7') # w7 is not loaded or created, but will be listed by listwalletdir because w7_symlink
36 to_create.append(os.path.join(self.options.tmpdir, 'extern/w6')) # External, not in the wallet dir, so we need to avoid adding it to in_wallet_dir
37 to_load = [self.default_wallet_name]
38:
39- os.mkdir(wallet_dir(node, 'w7'))
40- os.symlink('w7', wallet_dir(node, 'w7_symlink'))
41-
42 if self.check_symlinks:
43+ # Create symlink to verify wallet directory path can be referenced through symlink.
44+ os.mkdir(wallet_dir(node, 'w7'))
45+ os.symlink('w7', wallet_dir(node, 'w7_symlink'))
46 os.symlink('..', wallet_dir(node, 'recursive_dir_symlink'))
47
48 # rename wallet.dat to make sure plain wallet file paths (as opposed to
49@@ -153,12 +147,15 @@ class MultiWalletTest(BitcoinTestFramework):
50 # w - to verify wallet name matching works when one wallet path is prefix of another
51 # sub/w5 - to verify relative wallet path is created correctly
52 # extern/w6 - to verify absolute wallet path is created correctly
53- # w7_symlink - to verify symlinked wallet path is initialized correctly
54+ # w7_symlink - to verify symlinked wallet path is initialized correctly (symlink-capable platforms only)
55 # w8 - to verify existing wallet file is loaded correctly. Not tested for SQLite wallets as this is a deprecated BDB behavior.
56 # '' - to verify default wallet file is created correctly
57- to_create = ['w1', 'w2', 'w3', 'w', 'sub/w5', 'w7_symlink']
58+ to_create = ['w1', 'w2', 'w3', 'w', 'sub/w5']
59+ if self.check_symlinks:
60+ to_create.append('w7_symlink')
61 in_wallet_dir = [w.replace('/', os.path.sep) for w in to_create] # Wallets in the wallet dir
62- in_wallet_dir.append('w7') # w7 is not loaded or created, but will be listed by listwalletdir because w7_symlink
63+ if self.check_symlinks:
64+ in_wallet_dir.append('w7') # w7 is not loaded or created, but will be listed by listwalletdir because w7_symlink
65 to_create.append(os.path.join(self.options.tmpdir, 'extern/w6')) # External, not in the wallet dir, so we need to avoid adding it to in_wallet_dir
66 to_load = [self.default_wallet_name]