Added util.py, includes source directory import and TestWrapper class. - #8
Conversation
| @@ -0,0 +1,80 @@ | |||
| # Enter your source directory between the quotes here | |||
| SOURCE_DIRECTORY = '' | |||
There was a problem hiding this comment.
Im not strong on best practices for keeping user config values separate from other utility functions. Could keep as setup.py and somehow reference path from util.py, but could be awkward.
There was a problem hiding this comment.
Yeah, the only reason source dir path import and TestWrapper are consolidated in util.py is because I wanted to avoid to reference path from util.py, after setup.py sets source directory.
| """Wrapper Class for BitcoinTestFramework. | ||
|
|
||
| Provides the BitcoinTestFramework rpc & daemon process management | ||
| functionality to external python projects.""" |
There was a problem hiding this comment.
Might note here that the value of this class instead of just using BitcoinTestFramework is that weve provided a bunch of sane default settings as well as defaulting to setup 3 nodes. (at least that is my understanding of the raison d'etre for this class)
There was a problem hiding this comment.
Yes, BitcoinTestFramework sets defaults when reading command line arguments with argparse. Since we don't do that, we have to set the defaults in TestWrapper. Only when these options are set can we run the setup() and shutdown().
|
@jnewbery I am unsure of how best to implement the singleton pattern and detect other bitcoind instances. I would like to clarify how to move forward on this TestWrapper, since all other notebook pages depend on this PR. |
|
I'm going to merge this now. We can do a few tidy-ups to this later, but it's important we get this in so that the individual notebooks can be built on top of it. |
This PR moves the TestWrapper class from the bitcoin core source directory to the taproot-workhop repository. The bitcoin source directory path import has also been consolidated here.
Users now can do this:
import utiltest = util.TestWrapper()This PR depends on:
The refactor of
mainin BitcoinTestFramework, which is merged into the bitcoin/optech-taproot branch. The refactor spilts outsetupandshutdownfrommainso these methods are available to child classes, such as TestWrapper. This has been merged in optech-taproot-develop and tagged v0.1.TODO's: