test: skip test properly if zmq missing (#4684)

This commit is contained in:
thephez 2022-02-11 15:33:46 -06:00 committed by GitHub
parent fe0ebb3c04
commit dcc00ac8e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,10 +11,6 @@ import json
import random import random
import struct import struct
import time import time
try:
import zmq
finally:
pass
from test_framework.test_framework import DashTestFramework from test_framework.test_framework import DashTestFramework
from test_framework.mininode import P2PInterface from test_framework.mininode import P2PInterface
@ -104,6 +100,7 @@ class DashZMQTest (DashTestFramework):
# Check that dashd has been built with ZMQ enabled. # Check that dashd has been built with ZMQ enabled.
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read_file(open(self.options.configfile)) config.read_file(open(self.options.configfile))
import zmq
try: try:
# Setup the ZMQ subscriber socket # Setup the ZMQ subscriber socket
@ -232,6 +229,7 @@ class DashZMQTest (DashTestFramework):
self.unsubscribe(chain_lock_publishers) self.unsubscribe(chain_lock_publishers)
def test_instantsend_publishers(self): def test_instantsend_publishers(self):
import zmq
instantsend_publishers = [ instantsend_publishers = [
ZMQPublisher.hash_tx_lock, ZMQPublisher.hash_tx_lock,
ZMQPublisher.raw_tx_lock, ZMQPublisher.raw_tx_lock,