def monkey_patch(test_suite=False): """ Monkey patches `zmq.Context` and `zmq.Socket` If test_suite is True, the pyzmq test suite will be patched for compatibility as well. """ ozmq = __import__('zmq') ozmq.Socket = zmq.Socket ozmq.Context = zmq.Context if test_suite: from gevent_zeromq.tests import monkey_patch_test_suite monkey_patch_test_suite()
def monkey_patch(test_suite=False): """ Monkey patches `zmq.Context` and `zmq.Socket` If test_suite is True, the pyzmq test suite will be patched for compatibility as well. """ ozmq = __import__('zmq') ozmq.Socket = zmq.Socket ozmq.Context = zmq.Context ozmq.Poller = zmq.Poller ioloop = __import__('zmq.eventloop.ioloop') ioloop.Poller = zmq.Poller global IOLOOP_IS_MONKEYPATCHED IOLOOP_IS_MONKEYPATCHED = True if test_suite: from gevent_zeromq.tests import monkey_patch_test_suite monkey_patch_test_suite()