aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Chiang <james.chiangwu@gmail.com>2019-11-05 09:24:55 +0100
committerJames Chiang <james.chiangwu@gmail.com>2019-11-05 12:55:52 +0100
commit2493770e365a7e30117dc1b8d228f9cbed97f7e1 (patch)
tree24a77629340a439841bf9ac6e211744351690bac
parenta8dea4552412668c2914b6395ef543341a9898cd (diff)
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.
-rw-r--r--test/functional/test-shell.md6
-rw-r--r--test/functional/test_framework/test_shell.py1
2 files changed, 3 insertions, 4 deletions
diff --git a/test/functional/test-shell.md b/test/functional/test-shell.md
index 364fa871bb..f6ea9ef682 100644
--- a/test/functional/test-shell.md
+++ b/test/functional/test-shell.md
@@ -51,8 +51,7 @@ The following sections demonstrate how to initialize, run, and shut down a
## 3. Initializing a `TestShell` object
```
->>> test = TestShell()
->>> test.setup(num_nodes=2, setup_clean_chain=True)
+>>> test = TestShell().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
```
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.
```
->>> test2 = TestShell()
->>> test2.setup()
+>>> test2 = TestShell().setup()
TestShell is already running!
```
diff --git a/test/functional/test_framework/test_shell.py b/test/functional/test_framework/test_shell.py
index fe3d2bb1fa..26df128f1f 100644
--- a/test/functional/test_framework/test_shell.py
+++ b/test/functional/test_framework/test_shell.py
@@ -42,6 +42,7 @@ class TestShell:
super().setup()
self.running = True
+ return self
def shutdown(self):
if not self.running: