-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: refactor: dedup mempool_package_limits.py subtests via decorator #27350
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
test: refactor: dedup mempool_package_limits.py subtests via decorator #27350
Conversation
|
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. |
This avoids having to convert from BTC to Sats and needs less imports. Also specify the tx's target size in vsize rather than in weight, which allows us to specify the fee-rate by a simple multiplication, rather than having another magic number for it.
0ed2f03 to
e669833
Compare
glozow
left a comment
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.
utACK e669833
|
ACK e669833 |
| # "package-mempool-limits" for each tx | ||
| # 4) after mining a block, clearing the pre-submitted transactions from mempool, | ||
| # check that submitting the created package succeeds | ||
| def check_package_limits(func): |
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.
Nice 💯
Just a couple of nit minor suggestions to improve the readability of the code:
Add a blank line after the first assertion assert_equal(0, node.getmempoolinfo()["size"])
Add a blank line after the line where package_hex is assigned to func(self, *args, **kwargs)
Separating the operations as written in the decorator comment, also goes well with PEP9 guidelines.
The subtests in the functional test mempool_package_limits.py all follow the same pattern:
testmempoolaccepton the package hex fails with a "package-mempool-limits" error on each tx resultNote that steps 1,3,4 are identical for each of the subtests and only step 2 varies, so this might be a nice opportunity to deduplicate code by using a newly introduced decorator which executes the necessary before and after the essential part of the subtest. This also makes it easier to add new subtests without having to copy-paste those parts once again.
In addition, the first commit switches the fee unit from BTC to Satoshis, which allows to get rid of some imports (
COINandDecimal) and a comment for thetest_desc_size_limitssubtest is fixed (s/25KvB/21KvB/).