mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-01 03:01:09 +02:00
TestShell: Return self from setup()
This allows user to chain setup() to the initializer. test-shell.md code examples have been updated to reflect this.
This commit is contained in:
@ -51,8 +51,7 @@ The following sections demonstrate how to initialize, run, and shut down a
|
|||||||
## 3. Initializing a `TestShell` object
|
## 3. Initializing a `TestShell` object
|
||||||
|
|
||||||
```
|
```
|
||||||
>>> test = TestShell()
|
>>> test = TestShell().setup(num_nodes=2, setup_clean_chain=True)
|
||||||
>>> test.setup(num_nodes=2, setup_clean_chain=True)
|
|
||||||
20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Initializing test directory /path/to/bitcoin_func_test_XXXXXXX
|
20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Initializing test directory /path/to/bitcoin_func_test_XXXXXXX
|
||||||
```
|
```
|
||||||
The `TestShell` forwards all functional test parameters of the parent
|
The `TestShell` forwards all functional test parameters of the parent
|
||||||
@ -66,8 +65,7 @@ temporary folder. If you need more bitcoind nodes than set by default (1),
|
|||||||
simply increase the `num_nodes` parameter during setup.
|
simply increase the `num_nodes` parameter during setup.
|
||||||
|
|
||||||
```
|
```
|
||||||
>>> test2 = TestShell()
|
>>> test2 = TestShell().setup()
|
||||||
>>> test2.setup()
|
|
||||||
TestShell is already running!
|
TestShell is already running!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ class TestShell:
|
|||||||
|
|
||||||
super().setup()
|
super().setup()
|
||||||
self.running = True
|
self.running = True
|
||||||
|
return self
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
if not self.running:
|
if not self.running:
|
||||||
|
Reference in New Issue
Block a user