summaryrefslogtreecommitdiff
path: root/pactest/pmenv.py
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-02-21 06:33:13 +0000
committerAaron Griffin <aaron@archlinux.org>2007-02-21 06:33:13 +0000
commit786cd38c0a1cfeff96e5c755852a7e1c7f5e7d75 (patch)
tree3dbf7d7a1a314665602df9e1c0465afd3f2728e1 /pactest/pmenv.py
parenta8dd8d5770094ad8c925a56d47c3607c96363a51 (diff)
downloadpacman-786cd38c0a1cfeff96e5c755852a7e1c7f5e7d75.tar.xz
* Indentation changes - 4 spaces for python, we standardized this before (and
it's a PEP) * Modified some sync tests
Diffstat (limited to 'pactest/pmenv.py')
-rwxr-xr-xpactest/pmenv.py177
1 files changed, 89 insertions, 88 deletions
diff --git a/pactest/pmenv.py b/pactest/pmenv.py
index 5093612c..1665c522 100755
--- a/pactest/pmenv.py
+++ b/pactest/pmenv.py
@@ -25,94 +25,95 @@ import pmtest
class pmenv:
- """Environment object
- """
-
- def __init__(self, root = "root"):
- self.root = os.path.abspath(root)
- self.pacman = {
- "bin": "pacman",
- "debug": 0,
- "gdb": 0,
- "valgrind": 0,
- "nolog": 0
- }
- self.testcases = []
-
- def __str__(self):
- return "root = %s\n" \
- "pacman = %s" \
- % (self.root, self.pacman)
-
- def addtest(self, testcase):
- """
- """
- if not os.path.isfile(testcase):
- err("file %s not found" % testcase)
- return
- test = pmtest.pmtest(testcase, self.root)
- self.testcases.append(test)
-
- def run(self):
- """
- """
-
- for t in self.testcases:
- print "=========="*8
- print "Running '%s'" % t.name.strip(".py")
-
- t.load()
- print t.description
- print "----------"*8
-
- t.generate()
- # Hack for mtimes consistency
- modified = 0
- for i in t.rules:
- if i.rule.find("MODIFIED") != -1:
- modified = 1
- if modified:
- time.sleep(3)
-
- t.run(self.pacman)
-
- t.check()
- print "==> Test result"
- if t.result["ko"] == 0:
- print "\tPASSED"
- else:
- print "\tFAILED"
- print
-
- def results(self):
- """
- """
- passed = 0
- print "=========="*8
- print "Results"
- print "----------"*8
- for test in self.testcases:
- ok = test.result["ok"]
- ko = test.result["ko"]
- rules = len(test.rules)
- if ko == 0:
- print "[PASSED]",
- passed += 1
- else:
- print "[FAILED]",
- print test.name.strip(".py").ljust(38),
- print "Rules:",
- print "OK = %2u KO = %2u SKIP = %2u" % (ok, ko, rules-(ok+ko))
- print "----------"*8
- total = len(self.testcases)
- failed = total - passed
- print "TOTAL = %3u" % total
- if total:
- print "PASSED = %3u (%6.2f%%)" % (passed, float(passed)*100/total)
- print "FAILED = %3u (%6.2f%%)" % (failed, float(failed)*100/total)
- print
+ """Environment object
+ """
+
+ def __init__(self, root = "root"):
+ self.root = os.path.abspath(root)
+ self.pacman = {
+ "bin": "pacman",
+ "debug": 0,
+ "gdb": 0,
+ "valgrind": 0,
+ "nolog": 0
+ }
+ self.testcases = []
+
+ def __str__(self):
+ return "root = %s\n" \
+ "pacman = %s" \
+ % (self.root, self.pacman)
+
+ def addtest(self, testcase):
+ """
+ """
+ if not os.path.isfile(testcase):
+ err("file %s not found" % testcase)
+ return
+ test = pmtest.pmtest(testcase, self.root)
+ self.testcases.append(test)
+
+ def run(self):
+ """
+ """
+
+ for t in self.testcases:
+ print "=========="*8
+ print "Running '%s'" % t.name.strip(".py")
+
+ t.load()
+ print t.description
+ print "----------"*8
+
+ t.generate()
+ # Hack for mtimes consistency
+ modified = 0
+ for i in t.rules:
+ if i.rule.find("MODIFIED") != -1:
+ modified = 1
+ if modified:
+ time.sleep(3)
+
+ t.run(self.pacman)
+
+ t.check()
+ print "==> Test result"
+ if t.result["fail"] == 0:
+ print "\tPASSED"
+ else:
+ print "\tFAILED"
+ print
+
+ def results(self):
+ """
+ """
+ passed = 0
+ print "=========="*8
+ print "Results"
+ print "----------"*8
+ for test in self.testcases:
+ success = test.result["success"]
+ fail = test.result["fail"]
+ rules = len(test.rules)
+ if fail == 0:
+ print "[PASSED]",
+ passed += 1
+ else:
+ print "[FAILED]",
+ print test.name.strip(".py").ljust(38),
+ print "Rules:",
+ print " OK = %2u FAIL = %2u SKIP = %2u" % (success, fail, rules-(success+fail))
+ print "----------"*8
+ total = len(self.testcases)
+ failed = total - passed
+ print "TOTAL = %3u" % total
+ if total:
+ print "PASSED = %3u (%6.2f%%)" % (passed, float(passed)*100/total)
+ print "FAILED = %3u (%6.2f%%)" % (failed, float(failed)*100/total)
+ print
if __name__ == "__main__":
- env = pmenv("/tmp")
- print env
+ env = pmenv("/tmp")
+ print env
+# vim: set ts=4 sw=4 et: