def CMDstart_bot(args): """Starts the swarming bot.""" logging_utils.prepare_logging(os.path.join('logs', 'swarming_bot.log')) logging.info( 'importing bot_main: %s, %s', THIS_FILE, zip_package.generate_version()) from bot_code import bot_main result = bot_main.main(args) logging.info('bot_main exit code: %d', result) return result
def CMDstart_bot(args): """Starts the swarming bot.""" logging_utils.prepare_logging(os.path.join('logs', 'swarming_bot.log')) from bot_code import bot_main logging.info('importing bot_main: %s, %s', THIS_FILE, bot_main.generate_version()) adb_logger = logging.getLogger('adb') logging_utils.prepare_logging(os.path.join('logs', 'adb.log'), adb_logger) adb_logger.setLevel(logging.DEBUG) for child in ('high', 'low', 'usb', 'cmd'): adb_logger.getChild(child).setLevel(logging.DEBUG) adb_logger.propagate = False result = bot_main.main(args) logging.info('bot_main exit code: %d', result) return result
def test_main(self): def check(x): self.assertEqual(logging.WARNING, x) self.mock(logging_utils, 'set_console_level', check) def run_bot(error): self.assertEqual(None, error) return 0 self.mock(bot_main, '_run_bot', run_bot) class Singleton(object): # pylint: disable=no-self-argument def acquire(self2): return True def release(self2): self.fail() self.mock(bot_main, 'SINGLETON', Singleton()) self.assertEqual(0, bot_main.main([]))