Example #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
Example #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
Example #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
Example #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
Example #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
Example #6
0
 def it_should_run_once(self):
     ctx = Context()
     x = run(ctx.increment).every(3, 'seconds')
     x.join()
     return ctx.count == 1
Example #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
Example #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
Example #9
0
 def it_should_run_once(self):
     ctx = Context()
     x = run(ctx.increment).every(3, 'seconds')
     x.join()
     return ctx.count == 1
Example #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