index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2008-07-24 22:14:27 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-07-24 22:16:29 -0500 |
commit | cf25884e992e9c0dd6e4bf2f7cd4bb3252578bf6 (patch) | |
tree | 430b9f5675db96ea803aa52b081547bdedc83efc /pactest/pmenv.py | |
parent | 9f57921467ea368be96ffc09c8c35e9acfcc41ed (diff) |
-rwxr-xr-x | pactest/pmenv.py | 34 |
diff --git a/pactest/pmenv.py b/pactest/pmenv.py index b86abe94..e9d0b4c9 100755 --- a/pactest/pmenv.py +++ b/pactest/pmenv.py @@ -27,6 +27,12 @@ class pmenv: """Environment object """ + testcases = [] + passed = 0 + failed = 0 + expectedfail = 0 + unexpectedpass = 0 + def __init__(self, root = "root"): self.root = os.path.abspath(root) self.pacman = { @@ -36,7 +42,6 @@ class pmenv: "valgrind": 0, "nolog": 0 } - self.testcases = [] def __str__(self): return "root = %s\n" \ @@ -47,8 +52,7 @@ class pmenv: """ """ if not os.path.isfile(testcase): - err("file %s not found" % testcase) - return + raise IOError("test file %s not found" % testcase) test = pmtest.pmtest(testcase, self.root) self.testcases.append(test) @@ -84,27 +88,23 @@ class pmenv: def results(self): """ """ - passed = 0 tpassed = [] - failed = 0 tfailed = [] - expectedfail = 0 texpectedfail = [] - unexpectedpass = 0 tunexpectedpass = [] for test in self.testcases: fail = test.result["fail"] if fail == 0 and not test.expectfailure: - passed += 1 + self.passed += 1 tpassed.append(test) elif fail != 0 and test.expectfailure: - expectedfail += 1 + self.expectedfail += 1 texpectedfail.append(test) elif fail == 0: # and not test.expectfail - unexpectedpass += 1 + self.unexpectedpass += 1 tunexpectedpass.append(test) else: - failed += 1 + self.failed += 1 tfailed.append(test) def _printtest(t): @@ -142,13 +142,13 @@ class pmenv: total = len(self.testcases) print "Total = %3u" % total if total: - print "Pass = %3u (%6.2f%%)" % (passed, float(passed) * 100 / total) - print "Expected Fail = %3u (%6.2f%%)" % (expectedfail, float(expectedfail) * 100 / total) - print "Unexpected Pass = %3u (%6.2f%%)" % (unexpectedpass, float(unexpectedpass) * 100 / total) - print "Fail = %3u (%6.2f%%)" % (failed, float(failed) * 100 / total) + print "Pass = %3u (%6.2f%%)" % (self.passed, float(self.passed) * 100 / total) + print "Expected Fail = %3u (%6.2f%%)" % (self.expectedfail, float(self.expectedfail) * 100 / total) + print "Unexpected Pass = %3u (%6.2f%%)" % (self.unexpectedpass, float(self.unexpectedpass) * 100 / total) + print "Fail = %3u (%6.2f%%)" % (self.failed, float(self.failed) * 100 / total) print "" if __name__ == "__main__": - env = pmenv("/tmp") - print env + pass + # vim: set ts=4 sw=4 et: |