Esempio n. 1
0
 def it_should_run_every_5_seconds(self):
     """It should run every 2 seconds"""
     ctx = Context()
     x = run(ctx.increment).every(2, 'seconds')
     time.sleep(9)
     x.join()
     return ctx.count == 5
Esempio n. 2
0
 def it_should_run_every_5_seconds(self):
     """It should run every 2 seconds"""
     ctx = Context()
     x = run(ctx.increment).every(2, 'seconds')
     time.sleep(9)
     x.join()
     return ctx.count == 5
Esempio n. 3
0
        def it_should_stop_quickly(self):
            """It should stop quickly"""
            ts = time.time()
            x = run(stub).every(1, 'days')
            x.join()
            ts = time.time() - ts

            # Should end within 3 seconds
            return ts < 3
Esempio n. 4
0
        def it_should_stop_quickly(self):
            """It should stop quickly"""
            ts = time.time()
            x = run(stub).every(1, 'days')
            x.join()
            ts = time.time() - ts

            # Should end within 3 seconds
            return ts < 3
Esempio n. 5
0
 def it_should_run_twice(self):
     ctx = Context()
     x = run(ctx.increment).every(3, 'seconds')
     x.join(stop=False)
     return ctx.count == 2
Esempio n. 6
0
 def it_should_run_once(self):
     ctx = Context()
     x = run(ctx.increment).every(3, 'seconds')
     x.join()
     return ctx.count == 1
Esempio n. 7
0
 def it_should_not_run_immediately(self):
     """It should not run immediately"""
     ctx = Context()
     x = run(ctx.increment).every(1, 'hours', immediate=False)
     x.join()
     return ctx.count == 0
Esempio n. 8
0
 def it_should_run_twice(self):
     ctx = Context()
     x = run(ctx.increment).every(3, 'seconds')
     x.join(stop=False)
     return ctx.count == 2
Esempio n. 9
0
 def it_should_run_once(self):
     ctx = Context()
     x = run(ctx.increment).every(3, 'seconds')
     x.join()
     return ctx.count == 1
Esempio n. 10
0
 def it_should_not_run_immediately(self):
     """It should not run immediately"""
     ctx = Context()
     x = run(ctx.increment).every(1, 'hours', immediate=False)
     x.join()
     return ctx.count == 0