Fix unreliable test (#1126)

Also make error message more useful in case of future failures.
main
Vladimir Protasov 5 years ago committed by Selwin Ong
parent 1a382e761f
commit b62b9b0727

@ -337,8 +337,11 @@ class TestWorker(RQTestCase):
worker.perform_job(job, queue) worker.perform_job(job, queue)
worker.refresh() worker.refresh()
# total_working_time should be around 0.05 seconds # total_working_time should be a little bit more than 0.05 seconds
self.assertTrue(0.05 <= worker.total_working_time < 0.06) self.assertGreaterEqual(worker.total_working_time, 0.05)
# in multi-user environments delays might be unpredictable,
# please adjust this magic limit accordingly in case if It takes even longer to run
self.assertLess(worker.total_working_time, 1)
def test_max_jobs(self): def test_max_jobs(self):
"""Worker exits after number of jobs complete.""" """Worker exits after number of jobs complete."""

Loading…
Cancel
Save