Get rid of ugly custom assertion.

main
Vincent Driessen 13 years ago
parent fcca48a9d7
commit 7fff52d99c

@ -53,12 +53,3 @@ class RQTestCase(unittest.TestCase):
testconn = conn.pop() testconn = conn.pop()
assert testconn == cls.testconn, 'Wow, something really nasty happened to the Redis connection stack. Check your setup.' assert testconn == cls.testconn, 'Wow, something really nasty happened to the Redis connection stack. Check your setup.'
def assertQueueContains(self, queue, that_func):
# Do a queue scan (this is O(n), but we're in a test, so hey)
for job in queue.jobs:
if job.func == that_func:
return
self.fail('Queue %s does not contain message for function %s' %
(queue.key, that_func))

@ -46,7 +46,11 @@ class TestQueue(RQTestCase):
# testjob spec holds which queue this is sent to # testjob spec holds which queue this is sent to
q.enqueue(testjob, 'Nick', foo='bar') q.enqueue(testjob, 'Nick', foo='bar')
self.assertEquals(q.is_empty(), False) self.assertEquals(q.is_empty(), False)
self.assertQueueContains(q, testjob) for job in q.jobs:
if job.func == testjob:
break
else:
self.fail('Job not found on queue.')
def test_dequeue(self): def test_dequeue(self):

Loading…
Cancel
Save