Beispiel #1
0
 def test_worker_default_queue(self):
     '''
     Test ``jobs worker`` with the default queue.
     '''
     with tempfile.NamedTemporaryFile(delete=False) as f:
         self.enqueue(os.remove, args=[f.name])
         paster(u'jobs', u'worker', u'--burst')
         all_jobs = self.all_jobs()
         eq(all_jobs, [])
         nok(os.path.isfile(f.name))
Beispiel #2
0
 def test_worker_default_queue(self):
     '''
     Test ``jobs worker`` with the default queue.
     '''
     with tempfile.NamedTemporaryFile(delete=False) as f:
         self.enqueue(os.remove, args=[f.name])
         paster(u'jobs', u'worker', u'--burst')
         all_jobs = self.all_jobs()
         eq(all_jobs, [])
         nok(os.path.isfile(f.name))
Beispiel #3
0
 def test_worker_specific_queues(self):
     '''
     Test ``jobs worker`` with specific queues.
     '''
     with tempfile.NamedTemporaryFile(delete=False) as f:
         with tempfile.NamedTemporaryFile(delete=False) as g:
             job1 = self.enqueue()
             job2 = self.enqueue(queue=u'q2')
             self.enqueue(os.remove, args=[f.name], queue=u'q3')
             self.enqueue(os.remove, args=[g.name], queue=u'q4')
             paster(u'jobs', u'worker', u'--burst', u'q3', u'q4')
             all_jobs = self.all_jobs()
             eq(set(all_jobs), {job1, job2})
             nok(os.path.isfile(f.name))
             nok(os.path.isfile(g.name))
Beispiel #4
0
 def test_worker_specific_queues(self):
     '''
     Test ``jobs worker`` with specific queues.
     '''
     with tempfile.NamedTemporaryFile(delete=False) as f:
         with tempfile.NamedTemporaryFile(delete=False) as g:
             job1 = self.enqueue()
             job2 = self.enqueue(queue=u'q2')
             self.enqueue(os.remove, args=[f.name], queue=u'q3')
             self.enqueue(os.remove, args=[g.name], queue=u'q4')
             paster(u'jobs', u'worker', u'--burst', u'q3', u'q4')
             all_jobs = self.all_jobs()
             eq(set(all_jobs), {job1, job2})
             nok(os.path.isfile(f.name))
             nok(os.path.isfile(g.name))