def check_results(test_root = DEFAULT_ROOT, team=const.WARRIOR, tests = None): result_dir = get_config().get('pools', 'testresult') % team tests = get_tests(test_root) if not tests else tests results = [] for test in tests: result_folder = result_dir.rstrip('\\') + '\\' + test.split('/')[-1] if os.path.exists(result_folder): for root, dirs, files in os.walk(result_folder): files.sort() # result file name formart: 20120202171855_424_0_26_0.xml latest_result = files and files[-1].split('.')[0].split('_') result, date = convert_result([int(i) for i in latest_result]) result.setdefault('url', test) result.setdefault('latest_hostory', const.FIT_HISTORY % (test, date)) results.append(result) else: igone_res = {'red': False, 'gray': True, 'green': False} igone_res.setdefault('url', test) igone_res.setdefault('latest_hostory', test) results.append(igone_res) return sort_by_status(results)
def get_hosts(): labs = get_config().items('labs') return [Host( l[0], json.loads(l[1]) ) for l in labs]
from urllib2 import urlopen import os from runner import get_config import const try: import json except: import simplejson as json updated_value = lambda n: get_config().get('fitnesse', n) DEFAULT_ROOT = updated_value('rooturl') def get_tests(root=DEFAULT_ROOT): ''' root is a fitnesse url, this function returns all tests under this url ''' skiptests = updated_value('skiptests').split(',') relative_path = root.split('/')[-1] if relative_path in skiptests: return [] properties = get_properties(root) is_normal = not properties['Suite'] and not properties['Test'] is_suite = properties['Suite'] and not properties['Test'] is_test = not properties['Suite'] and properties['Test'] test_url = root test_list = [] if is_test: test_list.append(test_url)
def get_hosts(): labs = get_config().items('labs') return [Host(l[0], json.loads(l[1])) for l in labs]