-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: Remove wallet option from non-wallet tests #26480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "2211-test-wallet-options-\u{1F4A3}"
Conversation
The bool is only used to call a public helper, which some tests already do. So use the public helper in all tests consistently and make the confusingly named bool private.
self.descriptors is None when no wallet has been compiled, so it is safe to completely disable the wallet. This change will enhance a future commit.
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.
fafe79b to
555519d
Compare
|
The change here would also allow to enforce consistency when running the tests, so that review feedback like #24865 (comment) (or similar) can be detected locally before creating a pull request. Let me know if this is desired (in a follow-up). |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK. Approach wise I think a subclass for wallet tests (similar to #20892) is cleaner. Creating a subclass enables us to incapsulate wallet specific logic in one place instead of spreading it across test files. I'd like to hear the arguments against creating a new subclass for wallet tests. |
|
Concept ACK One issue I noticed is that |
|
Concept ACK. Approach meh considering we already have another place(s) we specify wallet-used/required in tests. Seems like it would be better to just let test classes define |
As Luke points out, there are at least 4 cases, so I don't think a single subclass will help. Maybe you can elaborate?
Yes, this is a bug that already exists on master. It can be trivially fixed with the changes here, see the new commit.
This is exactly what this pull is doing, no? Note that there is a difference between the "hard" skip and the "soft" option: Some tests may be mostly non-wallet, but have a small test portion that requires a wallet, but is skipped otherwise. If the wallet isn't compiled in, the test is still run, except for the small wallet portion. |
This PR seems to leave in place the previous wallet-required/used checks, but adds yet another place wallet-using tests need to explicitly define that they use the wallet. My suggestion is that tests should only need to define it one place (or at most two, to handle optional vs required) |
|
ACK fa10f19 |
This is impossible unless the test logic of a few tests is rewritten, so my suggestion would be to first rewrite the test logic and then address your concern. |
Why? Can't the class just make |
|
Sure you can turn the type bool into a tristate |
| self.options.descriptors = False | ||
| elif self.is_sqlite_compiled(): | ||
| self.options.descriptors = True | ||
| else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else block seems redundant. It sets value to None when it's None already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. This is also the current code on master. My guess is that this was done on purpose, to be able to attach a comment to the None value, which is why I left this as-is for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can replace the ... = None with pass, but I am not sure if this is an improvement.
What I had in mind is to create Approach ACK. |
|
Did anyone who commented here (or anyone else) wanted to review this? If not, it can probably be merged |
bcb7123 test: add add_wallet_options to TestShell (josibake) Pull request description: following 555519d, `TestShell` now always runs with `-disablewallet`. simple fix is to add `add_wallet_options` to `add_options`; looks like testshell was overlooked when adding in the `add_wallet_options` call to the functional tests in #26480 ACKs for top commit: amitiuttarwar: ACK bcb7123 Tree-SHA512: db554a8b3c8ff5bd10cab9592b316035a92f86a0a0ae8ff914de9687bbbb6fc2235bdf82c4cd40e4071782f8b6edf91aad372e82ed3b826c9d8ae39dbe3dbf57
The tests have several issues:
For example,
wallet_dump.pyoffers--descriptorsand on current master fails withJSONRPCException: Invalid public key. After the changes here, it fails with a clear error:unrecognized arguments: --descriptors.For example,
feature_addrman.pywill happily accept and run with--descriptorsor--legacy-wallet. After the changes here, it no longer silently ignores the flag, but reports a clear error:unrecognized arguments.