aboutsummaryrefslogtreecommitdiff
path: root/test/functional/tool_wallet.py
diff options
context:
space:
mode:
authorns-xvrn <ns@xvrn.tech>2023-09-02 01:09:43 -0400
committerns-xvrn <ns@xvrn.tech>2023-10-10 09:26:56 -0400
commitbfa0bd632a7ce5d04005e20cba79abb32aec8da8 (patch)
tree44e80e5f1339e5bb4308cc3c5de1abf2e60c543b /test/functional/tool_wallet.py
parent04265ba9378efbd4c35b33390b1e5cf246d420a9 (diff)
downloadbitcoin-bfa0bd632a7ce5d04005e20cba79abb32aec8da8.tar.xz
test: Use pathlib over os.path #28362
revert netutil chgs py3.8 compliant fixes based on PR review
Diffstat (limited to 'test/functional/tool_wallet.py')
-rwxr-xr-xtest/functional/tool_wallet.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py
index 8b0c8ce405..fc042bca66 100755
--- a/test/functional/tool_wallet.py
+++ b/test/functional/tool_wallet.py
@@ -32,7 +32,7 @@ class ToolWalletTest(BitcoinTestFramework):
self.skip_if_no_wallet_tool()
def bitcoin_wallet_process(self, *args):
- default_args = ['-datadir={}'.format(self.nodes[0].datadir), '-chain=%s' % self.chain]
+ default_args = ['-datadir={}'.format(self.nodes[0].datadir_path), '-chain=%s' % self.chain]
if not self.options.descriptors and 'create' in args:
default_args.append('-legacy')
@@ -153,8 +153,8 @@ class ToolWalletTest(BitcoinTestFramework):
assert_equal(v, r[k])
def do_tool_createfromdump(self, wallet_name, dumpfile, file_format=None):
- dumppath = os.path.join(self.nodes[0].datadir, dumpfile)
- rt_dumppath = os.path.join(self.nodes[0].datadir, "rt-{}.dump".format(wallet_name))
+ dumppath = self.nodes[0].datadir_path / dumpfile
+ rt_dumppath = self.nodes[0].datadir_path / "rt-{}.dump".format(wallet_name)
dump_data = self.read_dump(dumppath)
@@ -324,7 +324,7 @@ class ToolWalletTest(BitcoinTestFramework):
self.assert_raises_tool_error('No dump file provided. To use dump, -dumpfile=<filename> must be provided.', '-wallet=todump', 'dump')
self.log.info('Checking basic dump')
- wallet_dump = os.path.join(self.nodes[0].datadir, "wallet.dump")
+ wallet_dump = self.nodes[0].datadir_path / "wallet.dump"
self.assert_tool_output('The dumpfile may contain private keys. To ensure the safety of your Bitcoin, do not share the dumpfile.\n', '-wallet=todump', '-dumpfile={}'.format(wallet_dump), 'dump')
dump_data = self.read_dump(wallet_dump)
@@ -339,7 +339,7 @@ class ToolWalletTest(BitcoinTestFramework):
self.log.info('Checking createfromdump arguments')
self.assert_raises_tool_error('No dump file provided. To use createfromdump, -dumpfile=<filename> must be provided.', '-wallet=todump', 'createfromdump')
- non_exist_dump = os.path.join(self.nodes[0].datadir, "wallet.nodump")
+ non_exist_dump = self.nodes[0].datadir_path / "wallet.nodump"
self.assert_raises_tool_error('Unknown wallet file format "notaformat" provided. Please provide one of "bdb" or "sqlite".', '-wallet=todump', '-format=notaformat', '-dumpfile={}'.format(wallet_dump), 'createfromdump')
self.assert_raises_tool_error('Dump file {} does not exist.'.format(non_exist_dump), '-wallet=todump', '-dumpfile={}'.format(non_exist_dump), 'createfromdump')
wallet_path = self.nodes[0].wallets_path / "todump2"
@@ -354,17 +354,17 @@ class ToolWalletTest(BitcoinTestFramework):
self.do_tool_createfromdump("load-sqlite", "wallet.dump", "sqlite")
self.log.info('Checking createfromdump handling of magic and versions')
- bad_ver_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_ver1.dump")
+ bad_ver_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_ver1.dump"
dump_data["BITCOIN_CORE_WALLET_DUMP"] = "0"
self.write_dump(dump_data, bad_ver_wallet_dump)
self.assert_raises_tool_error('Error: Dumpfile version is not supported. This version of bitcoin-wallet only supports version 1 dumpfiles. Got dumpfile with version 0', '-wallet=badload', '-dumpfile={}'.format(bad_ver_wallet_dump), 'createfromdump')
assert not (self.nodes[0].wallets_path / "badload").is_dir()
- bad_ver_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_ver2.dump")
+ bad_ver_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_ver2.dump"
dump_data["BITCOIN_CORE_WALLET_DUMP"] = "2"
self.write_dump(dump_data, bad_ver_wallet_dump)
self.assert_raises_tool_error('Error: Dumpfile version is not supported. This version of bitcoin-wallet only supports version 1 dumpfiles. Got dumpfile with version 2', '-wallet=badload', '-dumpfile={}'.format(bad_ver_wallet_dump), 'createfromdump')
assert not (self.nodes[0].wallets_path / "badload").is_dir()
- bad_magic_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_magic.dump")
+ bad_magic_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_magic.dump"
del dump_data["BITCOIN_CORE_WALLET_DUMP"]
dump_data["not_the_right_magic"] = "1"
self.write_dump(dump_data, bad_magic_wallet_dump, "not_the_right_magic")
@@ -372,19 +372,19 @@ class ToolWalletTest(BitcoinTestFramework):
assert not (self.nodes[0].wallets_path / "badload").is_dir()
self.log.info('Checking createfromdump handling of checksums')
- bad_sum_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_sum1.dump")
+ bad_sum_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_sum1.dump"
dump_data = orig_dump.copy()
checksum = dump_data["checksum"]
dump_data["checksum"] = "1" * 64
self.write_dump(dump_data, bad_sum_wallet_dump)
self.assert_raises_tool_error('Error: Dumpfile checksum does not match. Computed {}, expected {}'.format(checksum, "1" * 64), '-wallet=bad', '-dumpfile={}'.format(bad_sum_wallet_dump), 'createfromdump')
assert not (self.nodes[0].wallets_path / "badload").is_dir()
- bad_sum_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_sum2.dump")
+ bad_sum_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_sum2.dump"
del dump_data["checksum"]
self.write_dump(dump_data, bad_sum_wallet_dump, skip_checksum=True)
self.assert_raises_tool_error('Error: Missing checksum', '-wallet=badload', '-dumpfile={}'.format(bad_sum_wallet_dump), 'createfromdump')
assert not (self.nodes[0].wallets_path / "badload").is_dir()
- bad_sum_wallet_dump = os.path.join(self.nodes[0].datadir, "wallet-bad_sum3.dump")
+ bad_sum_wallet_dump = self.nodes[0].datadir_path / "wallet-bad_sum3.dump"
dump_data["checksum"] = "2" * 10
self.write_dump(dump_data, bad_sum_wallet_dump)
self.assert_raises_tool_error('Error: Checksum is not the correct size', '-wallet=badload', '-dumpfile={}'.format(bad_sum_wallet_dump), 'createfromdump')
@@ -452,7 +452,7 @@ class ToolWalletTest(BitcoinTestFramework):
self.assert_tool_output(expected_output, "-wallet=conflicts", "info")
def run_test(self):
- self.wallet_path = os.path.join(self.nodes[0].wallets_path, self.default_wallet_name, self.wallet_data_filename)
+ self.wallet_path = self.nodes[0].wallets_path / self.default_wallet_name / self.wallet_data_filename
self.test_invalid_tool_commands_and_args()
# Warning: The following tests are order-dependent.
self.test_tool_wallet_info()