def test_execute_from_commandline(self): x = CeleryCommand(app=self.app) x.handle_argv = Mock() x.handle_argv.return_value = 1 with self.assertRaises(SystemExit): x.execute_from_commandline() x.handle_argv.return_value = True with self.assertRaises(SystemExit): x.execute_from_commandline() x.handle_argv.side_effect = KeyboardInterrupt() with self.assertRaises(SystemExit): x.execute_from_commandline() x.respects_app_option = True with self.assertRaises(SystemExit): x.execute_from_commandline(['celery', 'multi']) self.assertFalse(x.respects_app_option) x.respects_app_option = True with self.assertRaises(SystemExit): x.execute_from_commandline(['manage.py', 'celery', 'multi']) self.assertFalse(x.respects_app_option)