This is a followup to #32273
This removes duplicated code in test/functional/wallet_migration.py
6a7c0d3 addresses https://github.com/bitcoin/bitcoin/pull/32273/files#r2237317368
This is a followup to #32273
This removes duplicated code in test/functional/wallet_migration.py
6a7c0d3 addresses https://github.com/bitcoin/bitcoin/pull/32273/files#r2237317368
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33122.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | ryanofsky, l0rinc, jonatack |
Concept ACK | pablomartin4btc |
If your review is incorrectly listed, please react with π to this comment and the bot will ignore it on the next update.
641-
642- assert_equal(bals, wallet.getbalances())
643-
644- def test_wallet_with_path_ending_in_relative_specifier(self):
645+ def test_wallet_with_path(self, wallet_path):
646 self.log.info("Test migrating a wallet with a name/path ending in a relative specifier, '..'")
wallet_path
in the log? otherwise it would be seen as duplicated…
yea sure thing updated in 6ac5a351c99f0c0f1b80d179fc845fa55973c874
02025-08-01T23:29:43.011985Z TestFramework (INFO): Test migrating a wallet with the following path/name: path/to/mywallet/
12025-08-01T23:29:43.072030Z TestFramework (INFO): Test migrating a wallet with the following path/name: path/that/ends/in/..
4210- const std::string backup_prefix = wallet_name.empty() ? "default_wallet" : [&] {
4211- // fs::weakly_canonical resolves relative specifiers and remove trailing slashes.
4212- const auto legacy_wallet_path = fs::weakly_canonical(GetWalletDir() / fs::PathFromString(wallet_name));
4213- return fs::PathToString(legacy_wallet_path.filename());
4214+ // on walletname but expanded to "default_wallet" if it is empty and only
4215+ // the final filename portion is used if contains slashes.
walletname -> wallet name [compound term should be two words for clarity]
if contains slashes -> if it contains slashes [missing pronoun βitβ]
I like the test simplification in fa9f30f509ed0ba6e4afdcf98775acb4e8c9e461 but think it would be best to drop commit d1b71e5846e125f59cd60468f2d76c9721b1dc06 for now since @davidgumberg disagreed with this approach in #32273 (comment) it wouldn’t be good to override his preference while he’s out.
I do think d1b71e5846e125f59cd60468f2d76c9721b1dc06 is a minor improvement but there shouldn’t be any need to rush it. And if we do make this change it would be good to accompany it with a test. (A potential test could create a <datadir>/wallets/mywallet
symlink pointing to /path/to/my/wallet
and verify that the backup prefix is “mywallet_” not “wallet_”.)
6a7c0d3
Thanks! I did not see that comment
I dropped that commit and pushed 6a7c0d3 to just include the functional test change for this PR!
643-
644- def test_wallet_with_path_ending_in_relative_specifier(self):
645- self.log.info("Test migrating a wallet with a name/path ending in a relative specifier, '..'")
646- wallet_ending_in_relative = "path/that/ends/in/.."
647+ def test_wallet_with_path(self, wallet_path):
648+ self.log.info("Test migrating a wallet with the following path/name: %s", wallet_path)
(nit, only if you have to retouch) generally I believe we’ve been preferring to use f-strings for new python code
0 self.log.info(f"Test migrating a wallet with the following path/name: {wallet_path}")