104 print "Warning: no result file found! (Did you run the tests?)"
110 from tempfile
import mkdtemp
111 from shutil
import rmtree
113 origdir = os.getcwd()
117 os.popen(
"qmtest create-tdb",
"r").read()
120 out = os.popen(
"qmtest summarize -f brief %s"%r,
"r").read()
125 report[
"results"] += rep[
"results"]
126 if rep[
"not_passed"]:
127 report[
"not_passed"] += rep[
"not_passed"]
128 for k
in rep[
"statistics"]:
129 if k
in report[
"statistics"]:
130 report[
"statistics"][k] += rep[
"statistics"][k]
132 report[
"statistics"][k] = rep[
"statistics"][k]
135 rmtree(tmpdir,ignore_errors=
True)
138 print "Warning: I could not generate the report"
142 report[
"results"].append(
'')
143 if not report[
"not_passed"]:
144 report[
"not_passed"] = [
'',
' None.']
145 report[
"not_passed"] += [
'',
'']
147 statistics_output = [
'--- STATISTICS ---------------------------------------------------------------',
'']
150 tot = report[
"statistics"][
"total"]
151 statistics_output.append(
"%8d tests total"%(tot))
153 for k
in [
"ERROR",
"FAIL",
"UNTESTED",
"PASS" ]:
154 if k
in report[
"statistics"]:
155 n = report[
"statistics"][k]
156 p = round(100. * n / tot)
157 statistics_output.append(
"%8d (%3d%%) tests %s"%(n,p,k))
158 if k
in [
"ERROR",
"FAIL"]:
160 statistics_output.append(
'')
162 results_output = [
'--- TEST RESULTS -------------------------------------------------------------']
163 results_output += report[
"results"]
165 not_passed_output = [
'--- TESTS THAT DID NOT PASS --------------------------------------------------']
166 if not report[
"not_passed"]:
168 not_passed_output += report[
"not_passed"]
170 output = statistics_output + not_passed_output + results_output + not_passed_output + statistics_output
171 print '\n'.join(output)
def parse_summary(output)