def test_request_irise_id(self): instance = pyoptimus('raw_list') results = instance.build_results('com.tasktop.connector.irise', 1) self.assertEquals(int(results[0][0]), 16)
def test_request_irise_last_fails(self): instance = pyoptimus('raw_list') fails = instance.last_fails('com.tasktop.connector.irise') self.assertEquals(fails, 0)
def __init__(self, username, password): self.log_lines = [] self.jenkins = pyjenkins(username, password) self.optimus = pyoptimus('raw_list') assert self.jenkins.login() self._log_line("Login successful. [" + username + "]")
'''build statistics''' import numpy as np from pyoptimus import pyoptimus from collections import defaultdict def mean_std(arr): mean = float(np.mean(arr, axis=0)) std = float(np.std(arr, axis=0)) print "Mean={0:.2f}".format(mean) print "Std={0:.2f}".format(std) pyopt_raw = pyoptimus('raw_list') results = [r for r in pyopt_raw.build_results() if 'None' not in r] # Which day of the month as the most test failures? def failures_on_day(results): print "Which day of the month has the most test failures?" days = [str(i) for i in range(1, 32)] days_failures = defaultdict(int) for day in days: if len(day) == 1: day = '0' + day for result in results: if result[6] == day: days_failures[day] += int(result[2]) failure_list1 = [] for day in days:
'''usage example''' # import from pyoptimus import pyoptimus # instantiate an instance instance = pyoptimus() # get recent build results res = instance.build_results() # print a build result print res[0] # print number of build results retrieved print "Total build results: ", len(res) # grab build results for a certain connector sp_results = instance.build_results('sharepoint') print "Sharepoint build results: ", len(sp_results), sp_results[0] # Get a few rally build results and serialize as csv csv_instance = pyoptimus('csv') print csv_instance.schema() print csv_instance.build_results('jira')[:4]