def test_config(): config = Config() with pytest.raises(ConfigError): config.get('common', 'nonexisitingvalue') with pytest.raises(ConfigError): config.read_from('tests/bad_config.ini') config.read_from('tests/good_config.ini')
log = logger('staging release') parser = argparse.ArgumentParser() parser.add_argument('-c', '--cfg', help='configuration file', required=True) parser.add_argument('-b', '--bug', help='bug tracking id', required=True) parser.add_argument('-v', '--version', help='version', required=True) msg = 'staging release comma separated values (e.g: firefox,fennec)' parser.add_argument('-r', '--release', help=msg, required=True) msg = 'username: if not specified, whoami will be used' parser.add_argument('-u', '--username', help=msg) args = parser.parse_args() # reading configuration config = Config() config_ini = os.path.join(os.path.dirname(__file__), "config.ini") config.read_from(args.cfg) config.set('common', 'tracking_bug', args.bug) config.set('common', 'staging_release', args.release) config.set('common', 'version', args.version) if args.username: config.set('common', 'username', args.username) log.debug(config) relese_type = config.get_list('common', 'staging_release') # prepare buildbot-configs and tools to be patched # info about patching are inside the patch-<repository> section # and we need to pass it to our Patch objects patch_bc = PatchBuildbotConfigs(config, relese_type, 'patch-buildbot-configs') patch_tools = PatchTools(config, relese_type, 'patch-tools') repositories = Repositories(config) try: # repositories.prepare_user_repos()
if __name__ == '__main__': log = logger('staging release') parser = argparse.ArgumentParser() parser.add_argument('-b', '--bug', help='bug tracking id', required=True) msg = 'staging release comma separated values (e.g: firefox,fennec)' parser.add_argument('-r', '--release', help=msg, required=True) args = parser.parse_args() # reading configuration config = Config() config_ini = os.path.join(os.path.dirname(__file__), "config.ini") config.read_from(config_ini) config.set('common', 'tracking_bug', args.bug) config.set('common', 'staging_release', args.release) mj = MasterJson(config, 'master_config.json.ini') mj.write('') bc = BuildbotConfigs(config) # url = config.get('locales', 'url') # locales = locales.get_shipped_locales(url) # print locales # bc.delete_user_repo() # bc.create_repo() tmp_dir = '/tmp/bc-conf' # shutil.rmtree(tmp_dir, ignore_errors=True) # bc.clone_locally('/tmp/bc-conf') bc.local_checkout_dir = tmp_dir