All pastes #2109082 Raw Edit

stgraber

public text v1 · immutable
#2109082 ·published 2012-02-02 16:31 UTC
rendered paste body
#!/usr/bin/pythonimport xmlrpclib, sys, randomdrupal=xmlrpclib.ServerProxy("http://iso.qa.ubuntu.com/xmlrpc.php")config_milestone = "Precise Alpha 2"# Getting the milestoneprint "Getting milestone: %s" % config_milestonetesting = [milestone for milestone in drupal.qatracker.milestones.get_list([0]) if milestone['title'] == config_milestone]if not testing:    print "No available milestone"    sys.exit(1)milestoneid = testing[0]['id']# Getting all the builds for the milestone that aren't disabledprint "Getting all the builds for the milestone that aren't disabled"builds = drupal.qatracker.builds.get_list(int(milestoneid), [0])if not builds:    print "No available builds"    sys.exit(1)# Getting matching products for buildsprint "Getting matching products for builds"products = {}for product in drupal.qatracker.products.get_list([0]):    for build in builds:        if product['id'] == build['productid']:            products[product['id']] = product            breakif not products:    print "No available products"    sys.exit(1)# Getting mandatory testcases for these productsprint "Getting mandatory testcases for these products"testcases = {}for product in products:    testcases[product] = [testcase['id'] for testcase in drupal.qatracker.testcases.get_list(int(product), [0])]# Now work on a listprint "Getting the results"for build in sorted(builds, key=lambda build: products[build['productid']]['title']):    results = []    for testcase in testcases[build['productid']]:        # Get passed and failed results (ignore running)        results += drupal.qatracker.results.get_list(int(build['id']), int(testcase), [0, 1])    results_fail = [result for result in results if result['result'] == "0"]    results_pass = [result for result in results if result['result'] == "1"]    # Mark as ready anything that has results and not only failures    if results and results_pass:        print "READY: %s" % products[build['productid']]['title']    else:        print "NOT-READY: %s" % products[build['productid']]['title']