105 print "Warning: no result file found! (Did you run the tests?)"
111 from tempfile
import mkdtemp
112 from shutil
import rmtree
114 origdir = os.getcwd()
118 os.popen(
"qmtest create-tdb",
"r").read()
121 out = os.popen(
"qmtest summarize -f brief %s"%r,
"r").read()
126 report[
"results"] += rep[
"results"]
127 if rep[
"not_passed"]:
128 report[
"not_passed"] += rep[
"not_passed"]
129 for k
in rep[
"statistics"]:
130 if k
in report[
"statistics"]:
131 report[
"statistics"][k] += rep[
"statistics"][k]
133 report[
"statistics"][k] = rep[
"statistics"][k]
136 rmtree(tmpdir,ignore_errors=
True)
139 print "Warning: I could not generate the report"
143 report[
"results"].append(
'')
144 if not report[
"not_passed"]:
145 report[
"not_passed"] = [
'',
' None.']
146 report[
"not_passed"] += [
'',
'']
148 statistics_output = [
'--- STATISTICS ---------------------------------------------------------------',
'']
151 tot = report[
"statistics"][
"total"]
152 statistics_output.append(
"%8d tests total"%(tot))
154 for k
in [
"ERROR",
"FAIL",
"UNTESTED",
"PASS" ]:
155 if k
in report[
"statistics"]:
156 n = report[
"statistics"][k]
157 p = round(100. * n / tot)
158 statistics_output.append(
"%8d (%3d%%) tests %s"%(n,p,k))
159 if k
in [
"ERROR",
"FAIL"]:
161 statistics_output.append(
'')
163 results_output = [
'--- TEST RESULTS -------------------------------------------------------------']
164 results_output += report[
"results"]
166 not_passed_output = [
'--- TESTS THAT DID NOT PASS --------------------------------------------------']
167 if not report[
"not_passed"]:
169 not_passed_output += report[
"not_passed"]
171 output = statistics_output + not_passed_output + results_output + not_passed_output + statistics_output
172 print '\n'.join(output)