Example #1
0
    def test_eventlet_schedule_action_periodic_now(self):
        scheduler = EventLetEventScheduler()
        period = 0
        num_times = [3]

        def action(scheduler, state):
            num_times[0] -= 1

        scheduler.schedule_periodic(period, action)
        eventlet.sleep(.3)
        assert (num_times[0] == 2)
    def test_eventlet_schedule_action_periodic_now(self):
        scheduler = EventLetEventScheduler()
        period = 0
        num_times = [3]

        def action(state):
            num_times[0] -= 1

        scheduler.schedule_periodic(period, action)
        eventlet.sleep(0.3)
        assert num_times[0] == 2
Example #3
0
    def test_eventlet_schedule_action_periodic_now(self):
        scheduler = EventLetEventScheduler()
        period = 0
        counter = 3

        def action(state):
            nonlocal counter
            counter -= 1

        scheduler.schedule_periodic(period, action)
        eventlet.sleep(0.3)
        assert counter == 2
    def test_eventlet_schedule_action_periodic(self):
        scheduler = EventLetEventScheduler()
        period = 0.05
        counter = [3]

        def action(state):
            if counter[0]:
                counter[0] -= 1

        scheduler.schedule_periodic(period, action)
        eventlet.sleep(0.3)
        assert counter[0] == 0
Example #5
0
    def test_eventlet_schedule_action_periodic(self):
        scheduler = EventLetEventScheduler()
        period = 0.05
        counter = [3]

        def action(state):
            if counter[0]:
                counter[0] -= 1

        scheduler.schedule_periodic(period, action)
        eventlet.sleep(0.3)
        assert counter[0] == 0
Example #6
0
    def test_eventlet_schedule_action_periodic_now(self):
        scheduler = EventLetEventScheduler()
        period = 0
        counter = 3

        def action(state):
            nonlocal counter
            counter -= 1

        scheduler.schedule_periodic(period, action)
        eventlet.sleep(0.3)
        assert counter == 2