aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-08-24 11:11:56 -0400
committerMarcoFalke <falke.marco@gmail.com>2017-10-03 18:44:16 +0200
commit82bf6fc6d48a232cc0ceb54b136d86914f49013c (patch)
treed9709ea3cb26287e192aed77e65ca17cfb9c9a39 /test/functional/test_framework
parent801d2ae9247be5870344c8b4ed5c372ab8930408 (diff)
downloadbitcoin-82bf6fc6d48a232cc0ceb54b136d86914f49013c.tar.xz
[tests] Functional tests must explicitly set num_nodes
Github-Pull: #11121 Rebased-From: 7148b74dc39110f53c665b94fa9d994c6ad6dc1c
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-xtest/functional/test_framework/test_framework.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index d860bc5594..103651f175 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -48,11 +48,10 @@ BITCOIND_PROC_WAIT_TIMEOUT = 60
class BitcoinTestFramework(object):
"""Base class for a bitcoin test script.
- Individual bitcoin test scripts should subclass this class and override the run_test() method.
+ Individual bitcoin test scripts should subclass this class and override the set_test_params() and run_test() methods.
Individual tests can also override the following methods to customize the test setup:
- - set_test_params()
- add_options()
- setup_chain()
- setup_network()
@@ -64,12 +63,13 @@ class BitcoinTestFramework(object):
def __init__(self):
"""Sets test framework defaults. Do not override this method. Instead, override the set_test_params() method"""
- self.num_nodes = 4
self.setup_clean_chain = False
self.nodes = []
self.mocktime = 0
self.set_test_params()
+ assert hasattr(self, "num_nodes"), "Test must set self.num_nodes in set_test_params()"
+
def main(self):
"""Main function. This should not be overridden by the subclass test scripts."""
@@ -177,8 +177,8 @@ class BitcoinTestFramework(object):
# Methods to override in subclass test scripts.
def set_test_params(self):
- """Override this method to change default values for number of nodes, topology, etc"""
- pass
+ """Tests must this method to change default values for number of nodes, topology, etc"""
+ raise NotImplementedError
def add_options(self, parser):
"""Override this method to add command-line options to the test"""
@@ -212,7 +212,7 @@ class BitcoinTestFramework(object):
self.start_nodes()
def run_test(self):
- """Override this method to define test logic"""
+ """Tests must override this method to define test logic"""
raise NotImplementedError
# Public helper methods. These can be accessed by the subclass test scripts.