def setUp(self): if EventletConnection is None: raise unittest.SkipTest("Eventlet libraries not available") if not is_eventlet_monkey_patched(): raise unittest.SkipTest( "Can't test eventlet without monkey patching") EventletConnection.initialize_reactor()
def setUpClass(cls): # This is run even though the class is skipped, so we need # to make sure no monkey patching is happening if not MONKEY_PATCH_LOOP: return monkey_patch() cls.connection_class = EventletConnection EventletConnection.initialize_reactor()
def setUpClass(cls): # This is run even though the class is skipped, so we need # to make sure no monkey patching is happening if not MONKEY_PATCH_LOOP: return # This is being added temporarily due to a bug in eventlet: # https://github.com/eventlet/eventlet/issues/401 import eventlet; eventlet.sleep() monkey_patch() cls.connection_class = EventletConnection EventletConnection.initialize_reactor()
def setUpClass(cls): # This is run even though the class is skipped, so we need # to make sure no monkey patching is happening if skip_condition: return # This is being added temporarily due to a bug in eventlet: # https://github.com/eventlet/eventlet/issues/401 import eventlet eventlet.sleep() monkey_patch() # cls.connection_class = EventletConnection EventletConnection.initialize_reactor() assert EventletConnection._timers is not None
def test_timer_cancellation(self): """ Verify that timer cancellation is honored """ # Various lists for tracking callback stage timeout = .1 callback = TimerCallback(timeout) timer = EventletConnection.create_timer(timeout, callback.invoke) timer.cancel() # Release context allow for timer thread to run. time.sleep(.2) timer_manager = EventletConnection._timers # Assert that the cancellation was honored self.assertFalse(timer_manager._queue) self.assertFalse(timer_manager._new_timers) self.assertFalse(callback.was_invoked())
def setUp(self): if EventletConnection is None: raise unittest.SkipTest("Eventlet libraries not available") if not is_eventlet_monkey_patched(): raise unittest.SkipTest("Can't test eventlet without monkey patching") EventletConnection.initialize_reactor()