Esempio n. 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)
Esempio n. 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'])
Esempio n. 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)
Esempio n. 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)
Esempio n. 5
0
 def test_no_loglevel(self):
     app = Celery(set_as_current=False)
     app.Worker = Mock()
     WorkerCommand(app=app).run(loglevel=None)
Esempio n. 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')
Esempio n. 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'])
Esempio n. 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)
Esempio n. 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')