Skip to content

Commit

Permalink
Test rpc_help.py failed: Check whether ZMQ is enabled or not.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kvaciral committed Aug 31, 2018
1 parent 59ecacf commit 8dfc2f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
10 changes: 8 additions & 2 deletions test/functional/rpc_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC help output."""

from test_framework.test_framework import BitcoinTestFramework
from test_framework.test_framework import BitcoinTestFramework, is_zmq_enabled
from test_framework.util import assert_equal, assert_raises_rpc_error

class HelpRpcTest(BitcoinTestFramework):
Expand All @@ -25,7 +25,13 @@ def run_test(self):

# command titles
titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
assert_equal(titles, ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util', 'Wallet', 'Zmq'])

components = ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util', 'Wallet']

if is_zmq_enabled(self):
components.append('Zmq')

assert_equal(titles, components)

if __name__ == '__main__':
HelpRpcTest().main()
9 changes: 7 additions & 2 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,13 @@ def skip_if_no_py3_zmq():

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.")


def is_zmq_enabled(test_instance):
"""Checks whether zmq is enabled or not."""
config = configparser.ConfigParser()
config.read_file(open(test_instance.options.configfile))

if not config["components"].getboolean("ENABLE_ZMQ"):
raise SkipTest("bitcoind has not been built with zmq enabled.")
return config["components"].getboolean("ENABLE_ZMQ")

0 comments on commit 8dfc2f3

Please sign in to comment.