diff options
author | James O'Beirne <james.obeirne@gmail.com> | 2018-07-12 11:52:02 -0400 |
---|---|---|
committer | James O'Beirne <james.obeirne@gmail.com> | 2018-07-12 13:08:35 -0400 |
commit | a0b604c1661811c31c78bfa8ab029c1fc88472a9 (patch) | |
tree | 25a226224b1aadb30b0674fa7bc72d8f232ca5b7 /test/functional/interface_zmq.py | |
parent | dcb154e5aad80e49ff41a7851604ac46f38cb167 (diff) |
[tests] skip rpc_zmq functional test when python3 zmq lib is not present
Also refactors zmq-related test skipping logic into distinct functions.
Diffstat (limited to 'test/functional/interface_zmq.py')
-rwxr-xr-x | test/functional/interface_zmq.py | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/test/functional/interface_zmq.py b/test/functional/interface_zmq.py index af2e752b7a..def71c5f0f 100755 --- a/test/functional/interface_zmq.py +++ b/test/functional/interface_zmq.py @@ -3,10 +3,10 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the ZMQ notification interface.""" -import configparser import struct -from test_framework.test_framework import BitcoinTestFramework, SkipTest +from test_framework.test_framework import ( + BitcoinTestFramework, skip_if_no_bitcoind_zmq, skip_if_no_py3_zmq) from test_framework.mininode import CTransaction from test_framework.util import (assert_equal, bytes_to_hex_str, @@ -38,18 +38,9 @@ class ZMQTest (BitcoinTestFramework): self.num_nodes = 2 def setup_nodes(self): - # Try to import python3-zmq. Skip this test if the import fails. - try: - import zmq - except ImportError: - raise SkipTest("python3-zmq module not available.") - - # Check that bitcoin has been built with ZMQ enabled. - config = configparser.ConfigParser() - config.read_file(open(self.options.configfile)) - - if not config["components"].getboolean("ENABLE_ZMQ"): - raise SkipTest("bitcoind has not been built with zmq enabled.") + skip_if_no_py3_zmq() + skip_if_no_bitcoind_zmq(self) + import zmq # Initialize ZMQ context and socket. # All messages are received in the same socket which means |