Skip to content

Commit 2070a54

Browse files
committed
Merge #14122: Test rpc_help.py failed: Check whether ZMQ is enabled or not.
8dfc2f3 Test rpc_help.py failed: Check whether ZMQ is enabled or not. (Kvaciral) Pull request description: /test/functional/rpc_help.py checks for the zmq-category even while zmq may be disabled (in /test/config.ini) , I have added a check function to test_framework.py that can be used whether to determine to include zmq in a test or not. Tree-SHA512: 6819050277e2dc875f8d9bf49a02291555cb7b301379dfb9d898e6d8e14bfb8eeb6bef8af46d07b5db45b2fe281b35ea7f98af9ffba703768658a69addbc81b1
2 parents 59ecacf + 8dfc2f3 commit 2070a54

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

test/functional/rpc_help.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test RPC help output."""
66

7-
from test_framework.test_framework import BitcoinTestFramework
7+
from test_framework.test_framework import BitcoinTestFramework, is_zmq_enabled
88
from test_framework.util import assert_equal, assert_raises_rpc_error
99

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

2626
# command titles
2727
titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]
28-
assert_equal(titles, ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util', 'Wallet', 'Zmq'])
28+
29+
components = ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util', 'Wallet']
30+
31+
if is_zmq_enabled(self):
32+
components.append('Zmq')
33+
34+
assert_equal(titles, components)
2935

3036
if __name__ == '__main__':
3137
HelpRpcTest().main()

test/functional/test_framework/test_framework.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,13 @@ def skip_if_no_py3_zmq():
488488

489489
def skip_if_no_bitcoind_zmq(test_instance):
490490
"""Skip the running test if bitcoind has not been compiled with zmq support."""
491+
if not is_zmq_enabled(test_instance):
492+
raise SkipTest("bitcoind has not been built with zmq enabled.")
493+
494+
495+
def is_zmq_enabled(test_instance):
496+
"""Checks whether zmq is enabled or not."""
491497
config = configparser.ConfigParser()
492498
config.read_file(open(test_instance.options.configfile))
493499

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

0 commit comments

Comments
 (0)