Example #1
0
 def test_windows_B_option(self):
     celery = Celery(set_as_current=False)
     celery.IS_WINDOWS = True
     with self.assertRaises(SystemExit):
         WorkerCommand(app=celery).run(beat=True)
Example #2
0
 def test_setup_concurrency_very_early(self):
     x = WorkerCommand()
     x.run = Mock()
     with self.assertRaises(ImportError):
         x.execute_from_commandline(['worker', '-P', 'xyzybox'])
Example #3
0
 def test_unknown_loglevel(self):
     with self.assertRaises(SystemExit):
         WorkerCommand(app=self.app).run(loglevel='ALIEN')
     worker1 = self.Worker(loglevel=0xFFFF)
     self.assertEqual(worker1.loglevel, 0xFFFF)
Example #4
0
 def test_parse_options(self):
     cmd = WorkerCommand()
     cmd.app = current_app
     opts, args = cmd.parse_options('worker', ['--concurrency=512'])
     self.assertEqual(opts.concurrency, 512)
Example #5
0
 def test_no_loglevel(self):
     app = Celery(set_as_current=False)
     app.Worker = Mock()
     WorkerCommand(app=app).run(loglevel=None)
Example #6
0
 def test_invalid_loglevel_gives_error(self):
     x = WorkerCommand(app=Celery(set_as_current=False))
     with self.assertRaises(SystemExit):
         x.run(loglevel='GRIM_REAPER')
Example #7
0
 def test_setup_concurrency_very_early(self):
     x = WorkerCommand()
     x.run = Mock()
     with self.assertRaises(ImportError):
         x.execute_from_commandline(['worker', '-P', 'xyzybox'])
Example #8
0
 def test_parse_options(self):
     cmd = WorkerCommand()
     cmd.app = current_app
     opts, args = cmd.parse_options('worker', ['--concurrency=512'])
     self.assertEqual(opts.concurrency, 512)
Example #9
0
 def test_invalid_loglevel_gives_error(self):
     x = WorkerCommand(app=Celery(set_as_current=False))
     with self.assertRaises(SystemExit):
         x.run(loglevel='GRIM_REAPER')