Functions | |
def | parse_summary |
Variables | |
tuple | cmt_br_header_re = re.compile(r"^# Now trying.*in (.*) \([0-9]+/[0-9]+\)") |
list | dirs = [] |
old_CMTUSERCONTEXT = None | |
list | old_CMTUSERCONTEXT = os.environ["CMTUSERCONTEXT"] |
tuple | m = cmt_br_header_re.match(l) |
tuple | results = filter(os.path.isfile,[ os.path.realpath(os.path.join(d,'..',os.environ["CMTCONFIG"],"results.qmr")) for d in dirs ]) |
tuple | tmpdir = mkdtemp() |
tuple | origdir = os.getcwd() |
report = None | |
tuple | out = os.popen("qmtest summarize -f brief %s"%r,"r") |
tuple | rep = parse_summary(out) |
report = rep | |
list | statistics_output = ['--- STATISTICS ---------------------------------------------------------------',''] |
list | tot = report["statistics"] |
list | n = report["statistics"] |
tuple | p = round(100. * n / tot) |
list | results_output = ['--- TEST RESULTS -------------------------------------------------------------'] |
list | not_passed_output = ['--- TESTS THAT DID NOT PASS --------------------------------------------------'] |
output = statistics_output+not_passed_output+results_output+not_passed_output+statistics_output |
def fragments::qmtest_summarize::parse_summary | ( | output | ) |
Definition at line 11 of file qmtest_summarize.py.
00011 : 00012 report = { "results":[], "not_passed":[], "statistics": {} } 00013 current_block = None 00014 for l in output.splitlines(): 00015 if l.startswith("--- TEST RESULTS"): 00016 current_block = "results" 00017 elif l.startswith("--- TESTS THAT DID NOT PASS"): 00018 current_block = "not_passed" 00019 elif l.startswith("--- STATISTICS"): 00020 current_block = "statistics" 00021 else: 00022 if current_block in ["results","not_passed"]: 00023 report[current_block].append(l) 00024 elif current_block == "statistics": 00025 tkns = l.split() 00026 if tkns: 00027 report["statistics"][tkns[-1]] = int(tkns[0]) 00028 00029 report["results"] = report["results"][:-1] 00030 report["not_passed"] = report["not_passed"][:-2] 00031 if report["not_passed"][-1].strip() == "None.": 00032 report["not_passed"] = [] 00033 return report 00034 00035 # I assume that this script is run from a CMT action, which implies few other 00036 # things: 00037 # - we are in the cmt directory of a package 00038 # - CMTCONFIG etc. are correctly defined 00039 # - we can call cmt 00040 00041 # Directory where to store the report if "CMTINSTALLAREA" not in os.environ:
tuple fragments::qmtest_summarize::cmt_br_header_re = re.compile(r"^# Now trying.*in (.*) \([0-9]+/[0-9]+\)") [static] |
Definition at line 46 of file qmtest_summarize.py.
list fragments::qmtest_summarize::dirs = [] [static] |
Definition at line 47 of file qmtest_summarize.py.
fragments::qmtest_summarize::old_CMTUSERCONTEXT = None [static] |
Definition at line 50 of file qmtest_summarize.py.
list fragments::qmtest_summarize::old_CMTUSERCONTEXT = os.environ["CMTUSERCONTEXT"] [static] |
Definition at line 52 of file qmtest_summarize.py.
tuple fragments::qmtest_summarize::m = cmt_br_header_re.match(l) [static] |
Definition at line 56 of file qmtest_summarize.py.
tuple fragments::qmtest_summarize::results = filter(os.path.isfile,[ os.path.realpath(os.path.join(d,'..',os.environ["CMTCONFIG"],"results.qmr")) for d in dirs ]) [static] |
Definition at line 65 of file qmtest_summarize.py.
tuple fragments::qmtest_summarize::tmpdir = mkdtemp() [static] |
Definition at line 77 of file qmtest_summarize.py.
tuple fragments::qmtest_summarize::origdir = os.getcwd() [static] |
Definition at line 78 of file qmtest_summarize.py.
fragments::qmtest_summarize::report = None [static] |
Definition at line 79 of file qmtest_summarize.py.
tuple fragments::qmtest_summarize::out = os.popen("qmtest summarize -f brief %s"%r,"r") [static] |
Definition at line 85 of file qmtest_summarize.py.
tuple fragments::qmtest_summarize::rep = parse_summary(out) [static] |
Definition at line 86 of file qmtest_summarize.py.
fragments::qmtest_summarize::report = rep [static] |
Definition at line 88 of file qmtest_summarize.py.
list fragments::qmtest_summarize::statistics_output = ['--- STATISTICS ---------------------------------------------------------------',''] [static] |
Definition at line 112 of file qmtest_summarize.py.
list fragments::qmtest_summarize::tot = report["statistics"] [static] |
Definition at line 115 of file qmtest_summarize.py.
list fragments::qmtest_summarize::n = report["statistics"] [static] |
Definition at line 119 of file qmtest_summarize.py.
tuple fragments::qmtest_summarize::p = round(100. * n / tot) [static] |
Definition at line 120 of file qmtest_summarize.py.
list fragments::qmtest_summarize::results_output = ['--- TEST RESULTS -------------------------------------------------------------'] [static] |
Definition at line 124 of file qmtest_summarize.py.
list fragments::qmtest_summarize::not_passed_output = ['--- TESTS THAT DID NOT PASS --------------------------------------------------'] [static] |
Definition at line 127 of file qmtest_summarize.py.
fragments::qmtest_summarize::output = statistics_output+not_passed_output+results_output+not_passed_output+statistics_output [static] |
Definition at line 132 of file qmtest_summarize.py.