コード例 #1
0
 def test_timer_cancellation(self):
     # Various lists for tracking callback stage
     timeout = .1
     callback = TimerCallback(timeout)
     timer = self.create_timer(timeout, callback.invoke)
     timer.cancel()
     # Release context allow for timer thread to run.
     time.sleep(.2)
     # Assert that the cancellation was honored
     self.assertFalse(callback.was_invoked())
コード例 #2
0
 def test_timer_cancellation(self):
     # Various lists for tracking callback stage
     timeout = .1
     callback = TimerCallback(timeout)
     timer = self.create_timer(timeout, callback.invoke)
     timer.cancel()
     # Release context allow for timer thread to run.
     time.sleep(.2)
     # Assert that the cancellation was honored
     self.assertFalse(callback.was_invoked())
コード例 #3
0
    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())
コード例 #4
0
    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())
コード例 #5
0
    def test_timer_cancellation(self, *args):
        """
        Verify that timer cancellation is honored
        """

        # Various lists for tracking callback stage
        connection = twistedreactor.TwistedConnection('1.2.3.4',
                                                      cql_version='3.0.1')
        timeout = .1
        callback = TimerCallback(timeout)
        timer = connection.create_timer(timeout, callback.invoke)
        timer.cancel()
        # Release context allow for timer thread to run.
        time.sleep(.2)
        timer_manager = connection._loop._timers
        # Assert that the cancellation was honored
        self.assertFalse(timer_manager._queue)
        self.assertFalse(timer_manager._new_timers)
        self.assertFalse(callback.was_invoked())
コード例 #6
0
    def test_timer_cancellation(self, *args):
        """
        Verify that timer cancellation is honored
        """

        # Various lists for tracking callback stage
        connection = twistedreactor.TwistedConnection('1.2.3.4',
                                                       cql_version='3.0.1')
        timeout = .1
        callback = TimerCallback(timeout)
        timer = connection.create_timer(timeout, callback.invoke)
        timer.cancel()
        # Release context allow for timer thread to run.
        time.sleep(.2)
        timer_manager = connection._loop._timers
        # Assert that the cancellation was honored
        self.assertFalse(timer_manager._queue)
        self.assertFalse(timer_manager._new_timers)
        self.assertFalse(callback.was_invoked())