mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-27 20:49:30 +02:00
Merge #17378: TestShell: Fix typos & implement cleanups
2493770e36
TestShell: Return self from setup() (James Chiang)a8dea45524
TestShell: Simplify default setting of num_nodes (James Chiang)9c7806e4bf
Doc: Remove backticks in test-shell.md code block (James Chiang)d3ed06e2cd
TestShell: Fix typo in TestShell warning printout (James Chiang) Pull request description: This PR follows up on #17288 and fixes typos and implements code clean-ups suggested by reviewers of19139ee
. - Typo in `test_shell.py` warning - Typo in `test-shell.md` code block - Simplified default setting of `num_nodes` in `TestShell.setup()` - Enable initializer chaining: `TestShell().setup()` ACKs for top commit: MarcoFalke: ACK2493770e36
instagibbs: tACK2493770e36
jnewbery: utACK2493770e36
Tree-SHA512: 8fa7c2c550dbc3ec899de9dc328cd55cfa6daafe3b888aa5427e72fea69f064d938ec68e15bfa57109c0f6c3583e627ac4bd69303a11575d056941bd253adee0
This commit is contained in:
@@ -31,7 +31,7 @@ importing the `TestShell` class from the `test_shell` sub-package.
|
|||||||
```
|
```
|
||||||
>>> import sys
|
>>> import sys
|
||||||
>>> sys.path.insert(0, "/path/to/bitcoin/test/functional")
|
>>> sys.path.insert(0, "/path/to/bitcoin/test/functional")
|
||||||
>>> from test_framework.test_shell import `TestShell`
|
>>> from test_framework.test_shell import TestShell
|
||||||
```
|
```
|
||||||
|
|
||||||
The following `TestShell` methods manage the lifetime of the underlying bitcoind
|
The following `TestShell` methods manage the lifetime of the underlying bitcoind
|
||||||
@@ -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!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -29,8 +29,7 @@ class TestShell:
|
|||||||
|
|
||||||
# Num_nodes parameter must be set
|
# Num_nodes parameter must be set
|
||||||
# by BitcoinTestFramework child class.
|
# by BitcoinTestFramework child class.
|
||||||
self.num_nodes = kwargs.get('num_nodes', 1)
|
self.num_nodes = 1
|
||||||
kwargs.pop('num_nodes', None)
|
|
||||||
|
|
||||||
# User parameters override default values.
|
# User parameters override default values.
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
@@ -43,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:
|
||||||
@@ -53,7 +53,7 @@ class TestShell:
|
|||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
if self.running:
|
if self.running:
|
||||||
print("Shutdown TestWrapper before resetting!")
|
print("Shutdown TestShell before resetting!")
|
||||||
else:
|
else:
|
||||||
self.num_nodes = None
|
self.num_nodes = None
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
Reference in New Issue
Block a user