mirror of https://github.com/rq/rq.git
Fix flaky tests
This commit is contained in:
parent
809a20a8cc
commit
ba5c338441
|
@ -698,12 +698,12 @@ class TestWorker(RQTestCase):
|
||||||
# idle for 3 seconds
|
# idle for 3 seconds
|
||||||
right_now = now()
|
right_now = now()
|
||||||
self.assertIsNone(w.dequeue_job_and_maintain_ttl(1, max_idle_time=3))
|
self.assertIsNone(w.dequeue_job_and_maintain_ttl(1, max_idle_time=3))
|
||||||
self.assertLess((now() - right_now).total_seconds(), 5) # 5 for some buffer
|
self.assertLess((now() - right_now).total_seconds(), 6) # 6 for some buffer
|
||||||
|
|
||||||
# idle for 2 seconds because idle_time is less than timeout
|
# idle for 2 seconds because idle_time is less than timeout
|
||||||
right_now = now()
|
right_now = now()
|
||||||
self.assertIsNone(w.dequeue_job_and_maintain_ttl(3, max_idle_time=2))
|
self.assertIsNone(w.dequeue_job_and_maintain_ttl(3, max_idle_time=2))
|
||||||
self.assertLess((now() - right_now).total_seconds(), 4) # 4 for some buffer
|
self.assertLess((now() - right_now).total_seconds(), 5) # 5 for some buffer
|
||||||
|
|
||||||
w = Worker([q])
|
w = Worker([q])
|
||||||
w.worker_ttl = 2
|
w.worker_ttl = 2
|
||||||
|
@ -711,7 +711,7 @@ class TestWorker(RQTestCase):
|
||||||
|
|
||||||
# idle for 3 seconds because idle_time is less than two rounds of timeout
|
# idle for 3 seconds because idle_time is less than two rounds of timeout
|
||||||
w.work(max_idle_time=3)
|
w.work(max_idle_time=3)
|
||||||
self.assertLess((now() - right_now).total_seconds(), 5) # 5 for some buffer
|
self.assertLess((now() - right_now).total_seconds(), 6) # 6 for some buffer
|
||||||
|
|
||||||
@slow # noqa
|
@slow # noqa
|
||||||
def test_timeouts(self):
|
def test_timeouts(self):
|
||||||
|
|
Loading…
Reference in New Issue