From b62b9b0727eb7f6526a6842df1dee7b463729e1d Mon Sep 17 00:00:00 2001 From: Vladimir Protasov Date: Sun, 8 Sep 2019 14:09:12 +0300 Subject: [PATCH] Fix unreliable test (#1126) Also make error message more useful in case of future failures. --- tests/test_worker.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_worker.py b/tests/test_worker.py index 403e7bc..8f27223 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -337,8 +337,11 @@ class TestWorker(RQTestCase): worker.perform_job(job, queue) worker.refresh() - # total_working_time should be around 0.05 seconds - self.assertTrue(0.05 <= worker.total_working_time < 0.06) + # total_working_time should be a little bit more than 0.05 seconds + 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): """Worker exits after number of jobs complete."""