From d3ed06e2cdb31dcecf5e647f7e1e52185cc76733 Mon Sep 17 00:00:00 2001 From: James Chiang Date: Tue, 5 Nov 2019 08:47:14 +0100 Subject: [PATCH 1/4] TestShell: Fix typo in TestShell warning printout --- test/functional/test_framework/test_shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/test_framework/test_shell.py b/test/functional/test_framework/test_shell.py index 79da35b36..97fcc3fa4 100644 --- a/test/functional/test_framework/test_shell.py +++ b/test/functional/test_framework/test_shell.py @@ -53,7 +53,7 @@ class TestShell: def reset(self): if self.running: - print("Shutdown TestWrapper before resetting!") + print("Shutdown TestShell before resetting!") else: self.num_nodes = None super().__init__() From 9c7806e4bf113bee6c32cff7b46493fd1a5aa0ba Mon Sep 17 00:00:00 2001 From: James Chiang Date: Tue, 5 Nov 2019 08:49:05 +0100 Subject: [PATCH 2/4] Doc: Remove backticks in test-shell.md code block --- test/functional/test-shell.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/test-shell.md b/test/functional/test-shell.md index aefcdc5ec..364fa871b 100644 --- a/test/functional/test-shell.md +++ b/test/functional/test-shell.md @@ -31,7 +31,7 @@ importing the `TestShell` class from the `test_shell` sub-package. ``` >>> import sys >>> 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 From a8dea4552412668c2914b6395ef543341a9898cd Mon Sep 17 00:00:00 2001 From: James Chiang Date: Tue, 5 Nov 2019 08:59:40 +0100 Subject: [PATCH 3/4] TestShell: Simplify default setting of num_nodes --- test/functional/test_framework/test_shell.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/functional/test_framework/test_shell.py b/test/functional/test_framework/test_shell.py index 97fcc3fa4..fe3d2bb1f 100644 --- a/test/functional/test_framework/test_shell.py +++ b/test/functional/test_framework/test_shell.py @@ -29,8 +29,7 @@ class TestShell: # Num_nodes parameter must be set # by BitcoinTestFramework child class. - self.num_nodes = kwargs.get('num_nodes', 1) - kwargs.pop('num_nodes', None) + self.num_nodes = 1 # User parameters override default values. for key, value in kwargs.items(): From 2493770e365a7e30117dc1b8d228f9cbed97f7e1 Mon Sep 17 00:00:00 2001 From: James Chiang Date: Tue, 5 Nov 2019 09:24:55 +0100 Subject: [PATCH 4/4] 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 364fa871b..f6ea9ef68 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 fe3d2bb1f..26df128f1 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: