]>
wolfpit.net Git - tool/Arch-pacman/.git/blob - test/pacman/pmenv.py
3 # Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
34 def __init__(self
, root
= "root"):
35 self
.root
= os
.path
.abspath(root
)
45 return "root = %s\n" \
47 % (self
.root
, self
.pacman
)
49 def addtest(self
, testcase
):
52 if not os
.path
.isfile(testcase
):
53 raise IOError("test file %s not found" % testcase
)
54 test
= pmtest
.pmtest(testcase
, self
.root
)
55 self
.testcases
.append(test
)
61 for t
in self
.testcases
:
63 print "Running '%s'" % t
.testname
74 print "==> Test result"
75 if t
.result
["fail"] == 0:
88 for test
in self
.testcases
:
89 fail
= test
.result
["fail"]
90 if fail
== 0 and not test
.expectfailure
:
93 elif fail
!= 0 and test
.expectfailure
:
94 self
.expectedfail
+= 1
95 texpectedfail
.append(test
)
96 elif fail
== 0: # and not test.expectfail
97 self
.unexpectedpass
+= 1
98 tunexpectedpass
.append(test
)
104 success
= t
.result
["success"]
105 fail
= t
.result
["fail"]
112 print "%s Rules: OK = %2u FAIL = %2u SKIP = %2u" \
113 % (t
.testname
.ljust(34), success
, fail
, \
114 rules
- (success
+ fail
))
116 # print test description if test failed
117 print " ", t
.description
126 print " Expected Failures:"
127 for test
in texpectedfail
:
130 print " Unexpected Passes:"
131 for test
in tunexpectedpass
:
139 total
= len(self
.testcases
)
140 print "Total = %3u" % total
142 print "Pass = %3u (%6.2f%%)" % (self
.passed
, float(self
.passed
) * 100 / total
)
143 print "Expected Fail = %3u (%6.2f%%)" % (self
.expectedfail
, float(self
.expectedfail
) * 100 / total
)
144 print "Unexpected Pass = %3u (%6.2f%%)" % (self
.unexpectedpass
, float(self
.unexpectedpass
) * 100 / total
)
145 print "Fail = %3u (%6.2f%%)" % (self
.failed
, float(self
.failed
) * 100 / total
)
148 # vim: set ts=4 sw=4 et: