Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | class BitcoinTestFramework(): | ||||
This class also contains various public and private helper methods.""" | This class also contains various public and private helper methods.""" | ||||
def __init__(self): | def __init__(self): | ||||
"""Sets test framework defaults. Do not override this method. Instead, override the set_test_params() method""" | """Sets test framework defaults. Do not override this method. Instead, override the set_test_params() method""" | ||||
self.setup_clean_chain = False | self.setup_clean_chain = False | ||||
self.nodes = [] | self.nodes = [] | ||||
self.mocktime = 0 | 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): | def main(self): | ||||
"""Main function. This should not be overridden by the subclass test scripts.""" | """Main function. This should not be overridden by the subclass test scripts.""" | ||||
parser = optparse.OptionParser(usage="%prog [options]") | parser = optparse.OptionParser(usage="%prog [options]") | ||||
parser.add_option("--nocleanup", dest="nocleanup", default=False, action="store_true", | parser.add_option("--nocleanup", dest="nocleanup", default=False, action="store_true", | ||||
help="Leave bitcoinds and test.* datadir on exit or error") | help="Leave bitcoinds and test.* datadir on exit or error") | ||||
parser.add_option("--noshutdown", dest="noshutdown", default=False, action="store_true", | parser.add_option("--noshutdown", dest="noshutdown", default=False, action="store_true", | ||||
Show All 14 Lines | def main(self): | ||||
help="Write tested RPC commands into this directory") | help="Write tested RPC commands into this directory") | ||||
parser.add_option("--configfile", dest="configfile", | parser.add_option("--configfile", dest="configfile", | ||||
help="Location of the test framework config file") | help="Location of the test framework config file") | ||||
parser.add_option("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true", | parser.add_option("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true", | ||||
help="Attach a python debugger if test fails") | help="Attach a python debugger if test fails") | ||||
self.add_options(parser) | self.add_options(parser) | ||||
(self.options, self.args) = parser.parse_args() | (self.options, self.args) = parser.parse_args() | ||||
self.set_test_params() | |||||
assert hasattr( | |||||
self, "num_nodes"), "Test must set self.num_nodes in set_test_params()" | |||||
PortSeed.n = self.options.port_seed | PortSeed.n = self.options.port_seed | ||||
os.environ['PATH'] = self.options.srcdir + ":" + \ | os.environ['PATH'] = self.options.srcdir + ":" + \ | ||||
self.options.srcdir + "/qt:" + os.environ['PATH'] | self.options.srcdir + "/qt:" + os.environ['PATH'] | ||||
check_json_precision() | check_json_precision() | ||||
self.options.cachedir = os.path.abspath(self.options.cachedir) | self.options.cachedir = os.path.abspath(self.options.cachedir) | ||||
▲ Show 20 Lines • Show All 397 Lines • Show Last 20 Lines |