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 gevent.monkey.patch_all() cls.connection_class = GeventConnection GeventConnection.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 # There is no unpatching because there is not a clear way # of doing it reliably gevent.monkey.patch_all() GeventConnection.initialize_reactor()
def test_timer_cancellation(self): """ Verify that timer cancellation is honored """ # Various lists for tracking callback stage timeout = .1 callback = TimerCallback(timeout) timer = GeventConnection.create_timer(timeout, callback.invoke) timer.cancel() # Release context allow for timer thread to run. time.sleep(.2) timer_manager = GeventConnection._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 not is_gevent_monkey_patched(): raise unittest.SkipTest( "Can't test gevent without monkey patching") GeventConnection.initialize_reactor()
def setUp(self): if not is_gevent_monkey_patched(): raise unittest.SkipTest("Can't test gevent without monkey patching") GeventConnection.initialize_reactor()