From 2493770e365a7e30117dc1b8d228f9cbed97f7e1 Mon Sep 17 00:00:00 2001 From: James Chiang Date: Tue, 5 Nov 2019 09:24:55 +0100 Subject: [PATCH] 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. --- test/functional/test-shell.md | 6 ++---- test/functional/test_framework/test_shell.py | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/functional/test-shell.md b/test/functional/test-shell.md index 364fa871bbe..f6ea9ef6827 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 fe3d2bb1faf..26df128f1fe 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: