def testRevisions(self): prod = webapi.WebAPI('https://wrapdb.mesonbuild.com') projects = prod.projects() for project in projects: with self.subTest(project=project.name): for ver_id, version in project.versions.items(): self._testProjectVersion(project, ver_id, version)
def check_all(wrapdb, project_name=None, useragent=None, timeout=None): api = webapi.WebAPI(wrapdb) projects = api.projects() if project_name: project = projects.query_by_name(project_name) assert project print(check_project(project, useragent, timeout)) else: with concurrent.futures.ThreadPoolExecutor() as exe: def callback(project): return check_project_async( wrapdb, project.name, useragent, timeout) for result in exe.map(callback, projects): print(result, end='')
def main(prog, args): parser = argparse.ArgumentParser(prog) parser.add_argument('--wrapdb_url', default='http://wrapdb.mesonbuild.com') parser.add_argument('--project') parser.add_argument('--version', help='Does not work without --project') parser.add_argument('--revision', help='Does not work without --version') args = parser.parse_args(args) api = webapi.WebAPI(args.wrapdb_url) projects = api.projects() with Importer() as imp: if args.project: project = projects[args.project] if args.version: version = project.versions[args.version] if args.revision: imp.import_revision(version.revisions[args.revision]) else: imp.import_version(version) else: imp.import_project(project) else: for project in projects: imp.import_project(project)
def check_project_async(wrapdb, project_name, useragent, timeout) -> str: project = webapi.WebAPI(wrapdb).projects().query_by_name(project_name) assert project return check_project(project, useragent, timeout)
def __init__(self): super(Server, self).__init__(args=SERVER) self.api = webapi.WebAPI('http://localhost:5000') self._wait_server_ready()