Skip to content

Commit 2493770

Browse files
committed
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.
1 parent a8dea45 commit 2493770

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

test/functional/test-shell.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ The following sections demonstrate how to initialize, run, and shut down a
5151
## 3. Initializing a `TestShell` object
5252

5353
```
54-
>>> test = TestShell()
55-
>>> test.setup(num_nodes=2, setup_clean_chain=True)
54+
>>> test = TestShell().setup(num_nodes=2, setup_clean_chain=True)
5655
20XX-XX-XXTXX:XX:XX.XXXXXXX TestFramework (INFO): Initializing test directory /path/to/bitcoin_func_test_XXXXXXX
5756
```
5857
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),
6665
simply increase the `num_nodes` parameter during setup.
6766

6867
```
69-
>>> test2 = TestShell()
70-
>>> test2.setup()
68+
>>> test2 = TestShell().setup()
7169
TestShell is already running!
7270
```
7371

test/functional/test_framework/test_shell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def setup(self, **kwargs):
4242

4343
super().setup()
4444
self.running = True
45+
return self
4546

4647
def shutdown(self):
4748
if not self.running:

0 commit comments

Comments
 (0)