qa: Run all tests even if wallet is not compiled
This commit is contained in:
parent
faa669cbcd
commit
fac9539836
85 changed files with 378 additions and 72 deletions
test/functional/test_framework
|
@ -44,6 +44,13 @@ TEST_EXIT_FAILED = 1
|
|||
TEST_EXIT_SKIPPED = 77
|
||||
|
||||
|
||||
class SkipTest(Exception):
|
||||
"""This exception is raised to skip a test"""
|
||||
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
|
||||
|
||||
class BitcoinTestMetaClass(type):
|
||||
"""Metaclass for BitcoinTestFramework.
|
||||
|
||||
|
@ -156,6 +163,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
try:
|
||||
if self.options.usecli and not self.supports_cli:
|
||||
raise SkipTest("--usecli specified but test does not support using CLI")
|
||||
self.skip_test_if_missing_module()
|
||||
self.setup_chain()
|
||||
self.setup_network()
|
||||
self.import_deterministic_coinbase_privkeys()
|
||||
|
@ -221,6 +229,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
"""Override this method to add command-line options to the test"""
|
||||
pass
|
||||
|
||||
def skip_test_if_missing_module(self):
|
||||
"""Override this method to skip a test if a module is not compiled"""
|
||||
pass
|
||||
|
||||
def setup_chain(self):
|
||||
"""Override this method to customize blockchain setup"""
|
||||
self.log.info("Initializing test directory " + self.options.tmpdir)
|
||||
|
@ -486,30 +498,45 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
for i in range(self.num_nodes):
|
||||
initialize_datadir(self.options.tmpdir, i)
|
||||
|
||||
def skip_if_no_py3_zmq(self):
|
||||
"""Attempt to import the zmq package and skip the test if the import fails."""
|
||||
try:
|
||||
import zmq # noqa
|
||||
except ImportError:
|
||||
raise SkipTest("python3-zmq module not available.")
|
||||
|
||||
class SkipTest(Exception):
|
||||
"""This exception is raised to skip a test"""
|
||||
def __init__(self, message):
|
||||
self.message = message
|
||||
def skip_if_no_bitcoind_zmq(self):
|
||||
"""Skip the running test if bitcoind has not been compiled with zmq support."""
|
||||
if not self.is_zmq_compiled():
|
||||
raise SkipTest("bitcoind has not been built with zmq enabled.")
|
||||
|
||||
def skip_if_no_wallet(self):
|
||||
"""Skip the running test if wallet has not been compiled."""
|
||||
if not self.is_wallet_compiled():
|
||||
raise SkipTest("wallet has not been compiled.")
|
||||
|
||||
def skip_if_no_py3_zmq():
|
||||
"""Attempt to import the zmq package and skip the test if the import fails."""
|
||||
try:
|
||||
import zmq # noqa
|
||||
except ImportError:
|
||||
raise SkipTest("python3-zmq module not available.")
|
||||
def skip_if_no_cli(self):
|
||||
"""Skip the running test if bitcoin-cli has not been compiled."""
|
||||
if not self.is_cli_compiled():
|
||||
raise SkipTest("bitcoin-cli has not been compiled.")
|
||||
|
||||
def is_cli_compiled(self):
|
||||
"""Checks whether bitcoin-cli was compiled."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
def skip_if_no_bitcoind_zmq(test_instance):
|
||||
"""Skip the running test if bitcoind has not been compiled with zmq support."""
|
||||
if not is_zmq_enabled(test_instance):
|
||||
raise SkipTest("bitcoind has not been built with zmq enabled.")
|
||||
return config["components"].getboolean("ENABLE_UTILS")
|
||||
|
||||
def is_wallet_compiled(self):
|
||||
"""Checks whether the wallet module was compiled."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
def is_zmq_enabled(test_instance):
|
||||
"""Checks whether zmq is enabled or not."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(test_instance.options.configfile))
|
||||
return config["components"].getboolean("ENABLE_WALLET")
|
||||
|
||||
return config["components"].getboolean("ENABLE_ZMQ")
|
||||
def is_zmq_compiled(self):
|
||||
"""Checks whether the zmq module was compiled."""
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(self.options.configfile))
|
||||
|
||||
return config["components"].getboolean("ENABLE_ZMQ")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue