Change assertEqual to assertGreaterThan, to make the test a little less

brittle (on slow machines).
main
Vincent Driessen 13 years ago
parent a5e6765990
commit 5fcedbcdad

@ -254,7 +254,7 @@ class TestFailedQueue(RQTestCase):
self.assertEquals(job.timeout, 200) self.assertEquals(job.timeout, 200)
def test_enqueue_preserves_result_ttl(self): def test_enqueue_preserves_result_ttl(self):
"""Ensure that result_ttl argument are properly persisted to Redis.""" """Enqueueing persists result_ttl."""
q = Queue() q = Queue()
job = q.enqueue(div_by_zero, args=(1, 2, 3), result_ttl=10) job = q.enqueue(div_by_zero, args=(1, 2, 3), result_ttl=10)
self.assertEqual(job.result_ttl, 10) self.assertEqual(job.result_ttl, 10)

@ -96,7 +96,6 @@ class TestWorker(RQTestCase):
self.assertEquals(job.enqueued_at, enqueued_at_date) self.assertEquals(job.enqueued_at, enqueued_at_date)
self.assertIsNotNone(job.exc_info) # should contain exc_info self.assertIsNotNone(job.exc_info) # should contain exc_info
def test_cancelled_jobs_arent_executed(self): # noqa def test_cancelled_jobs_arent_executed(self): # noqa
"""Cancelling jobs.""" """Cancelling jobs."""
@ -147,7 +146,6 @@ class TestWorker(RQTestCase):
assert self.testconn.ttl(job_with_rv.key) > 0 assert self.testconn.ttl(job_with_rv.key) > 0
assert not self.testconn.exists(job_without_rv.key) assert not self.testconn.exists(job_without_rv.key)
@slow # noqa @slow # noqa
def test_timeouts(self): def test_timeouts(self):
"""Worker kills jobs after timeout.""" """Worker kills jobs after timeout."""
@ -182,12 +180,10 @@ class TestWorker(RQTestCase):
job = q.enqueue(say_hello, args=('Frank',), result_ttl=10) job = q.enqueue(say_hello, args=('Frank',), result_ttl=10)
w = Worker([q]) w = Worker([q])
w.work(burst=True) w.work(burst=True)
self.assertEqual(self.testconn.ttl(job.key), 10) self.assertNotEqual(self.testconn.ttl(job.key), 0)
# Job with -1 result_ttl don't expire # Job with -1 result_ttl don't expire
job = q.enqueue(say_hello, args=('Frank',), result_ttl=-1) job = q.enqueue(say_hello, args=('Frank',), result_ttl=-1)
w = Worker([q]) w = Worker([q])
w.work(burst=True) w.work(burst=True)
self.assertEqual(self.testconn.ttl(job.key), None) self.assertEqual(self.testconn.ttl(job.key), None)

Loading…
Cancel
Save