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)
def test_setup_concurrency_very_early(self): x = WorkerCommand() x.run = Mock() with self.assertRaises(ImportError): x.execute_from_commandline(['worker', '-P', 'xyzybox'])
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)
def test_parse_options(self): cmd = WorkerCommand() cmd.app = current_app opts, args = cmd.parse_options('worker', ['--concurrency=512']) self.assertEqual(opts.concurrency, 512)
def test_no_loglevel(self): app = Celery(set_as_current=False) app.Worker = Mock() WorkerCommand(app=app).run(loglevel=None)
def test_invalid_loglevel_gives_error(self): x = WorkerCommand(app=Celery(set_as_current=False)) with self.assertRaises(SystemExit): x.run(loglevel='GRIM_REAPER')