-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Bugfix & simplify bn2vch using int.to_bytes #18378
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
Conversation
c3e08bf to
57d1428
Compare
57d1428 to
a733ad5
Compare
|
Concept ACK. The code was broken here: f950ec2#diff-fb7bd6a727cfb726928c6f68fa8b3a80R20. |
jnewbery
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.
Tested ACK a733ad5.
I cherry-picked just the test onto:
Longer term, I think it'd be nicer if the tests for the test framework were unit tests within those files, because it doesn't make much sense to me to have them as subclasses of the TestFramework object, and because it's nice to have the test code next to the code it's testing. However, that's something that could be done separately.
|
Concept ACK |
|
@jnewbery Yeah, that's pretty ugly. Happy to take any concrete suggestions (in this PR or later). |
Let's do it in a follow-up. |
|
nice, ACK a733ad5 |
de8905a test: use unittest and test_runner for test framework unit testing (Gloria Zhao) Pull request description: Proposal for unit testing on test_framework functions: 1. Use the python `unittest` library. Don't use test_framework to test itself. 2. Put the tests inside the same file as the functions they are testing. 3. Call the tests from `test_runner.py`. To include more Test Framework tests, add the filename to the list `TEST_FRAMEWORK_MODULES`. Don't add new files or change the list of accepted script prefixes. Makes these changes for `bn2vch` (followup to [this comment](#18378 (review))). ACKs for top commit: jnewbery: Tested ACK de8905a. Great stuff gzhao408 . Thanks for this! Tree-SHA512: 91572d43e203a1864765b93a9472667994115ec38b271f2b2f9fcd0f0112b393fc24ba7d2371d5a34b0a6a4522f6b934fc5164363819aa7ed8d6c6c9a60cc101
de8905a test: use unittest and test_runner for test framework unit testing (Gloria Zhao) Pull request description: Proposal for unit testing on test_framework functions: 1. Use the python `unittest` library. Don't use test_framework to test itself. 2. Put the tests inside the same file as the functions they are testing. 3. Call the tests from `test_runner.py`. To include more Test Framework tests, add the filename to the list `TEST_FRAMEWORK_MODULES`. Don't add new files or change the list of accepted script prefixes. Makes these changes for `bn2vch` (followup to [this comment](bitcoin#18378 (review))). ACKs for top commit: jnewbery: Tested ACK de8905a. Great stuff gzhao408 . Thanks for this! Tree-SHA512: 91572d43e203a1864765b93a9472667994115ec38b271f2b2f9fcd0f0112b393fc24ba7d2371d5a34b0a6a4522f6b934fc5164363819aa7ed8d6c6c9a60cc101
Summary: Add a new test for a helper function in the test framework (added in D8852) Introduce a new prefix for functional tests: `framework_test` This concludes backport of Core [[bitcoin/bitcoin#18378 | PR18378]] bitcoin/bitcoin@a733ad5 Depends on D8852 Test Plan: `test/functional/test_runner.py framework_test_script` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Differential Revision: https://reviews.bitcoinabc.org/D8855
Alternative to #18374, fixing the incorrect padding added sometimes in
bn2vch.Since we're using Python 3.2+, a much simpler implementation of
bn2vchis possible usingint.to_bytes.This also adds a "functional" test for bn2vch, in a new "framework_test_script.py", where the "framework_test_" prefix is intended for tests of the framework itself.