summaryrefslogtreecommitdiff
path: root/pactest
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-02-28 16:37:24 +0000
committerDan McGee <dan@archlinux.org>2007-02-28 16:37:24 +0000
commit13e21110459aaf99dd739802c2b07b3d5b9e2a68 (patch)
treee8df3fa922cbd076185e56f1cd0e3a665c17b58d /pactest
parentbdac9105892dae8b74952f86300e6161363b93d4 (diff)
downloadpacman-13e21110459aaf99dd739802c2b07b3d5b9e2a68.tar.xz
* Unifying placement of REPLACES in desc file, as pacman2 does. We'll worry
about bigger DB changes later, but lets not screw anything up for release. * Removed some weird uses of "not ... ==" usage in pactest- correct me if I'm wrong, but isn't "!=" a lot more clean and concise? * Print description of failed tests in the pactest summary. This could get dirty with a lot of failed tests though, so watch out.
Diffstat (limited to 'pactest')
-rwxr-xr-xpactest/pmdb.py25
-rwxr-xr-xpactest/pmenv.py11
-rwxr-xr-xpactest/pmfile.py4
-rwxr-xr-xpactest/pmrule.py2
-rwxr-xr-xpactest/util.py9
5 files changed, 30 insertions, 21 deletions
diff --git a/pactest/pmdb.py b/pactest/pmdb.py
index ba707bd8..3720bcea 100755
--- a/pactest/pmdb.py
+++ b/pactest/pmdb.py
@@ -193,11 +193,12 @@ class pmdb:
pkg.conflicts = _getsection(fd)
elif line == "%PROVIDES%":
pkg.provides = _getsection(fd)
- elif line == "%REPLACES%":
- pkg.replaces = _getsection(fd)
- elif line == "%FORCE%":
- fd.readline()
- pkg.force = 1
+ # TODO this was going to be changed, but isn't anymore
+ #elif line == "%REPLACES%":
+ # pkg.replaces = _getsection(fd)
+ #elif line == "%FORCE%":
+ # fd.readline()
+ # pkg.force = 1
fd.close()
pkg.checksum["depends"] = getmd5sum(filename)
pkg.mtime["depends"] = getmtime(filename)
@@ -253,6 +254,8 @@ class pmdb:
else:
if pkg.replaces:
data.append(_mksection("REPLACES", pkg.replaces))
+ if pkg.force:
+ data.append(_mksection("FORCE", ""))
if pkg.csize:
data.append(_mksection("CSIZE", pkg.csize))
if pkg.md5sum:
@@ -293,11 +296,11 @@ class pmdb:
data.append(_mksection("CONFLICTS", pkg.conflicts))
if pkg.provides:
data.append(_mksection("PROVIDES", pkg.provides))
- if not self.treename == "local":
- if pkg.replaces:
- data.append(_mksection("REPLACES", pkg.replaces))
- if pkg.force:
- data.append(_mksection("FORCE", ""))
+ #if self.treename != "local":
+ # if pkg.replaces:
+ # data.append(_mksection("REPLACES", pkg.replaces))
+ # if pkg.force:
+ # data.append(_mksection("FORCE", ""))
if data:
data.append("")
filename = os.path.join(path, "depends")
@@ -354,7 +357,7 @@ class pmdb:
and oldpkg.mtime[key] == (0, 0, 0) \
and pkg.mtime[key] == (0, 0, 0):
continue
- if not oldpkg.mtime[key][1:3] == pkg.mtime[key][1:3]:
+ if oldpkg.mtime[key][1:3] != pkg.mtime[key][1:3]:
modified += 1
return modified
diff --git a/pactest/pmenv.py b/pactest/pmenv.py
index 3a2ecb14..56af2e9a 100755
--- a/pactest/pmenv.py
+++ b/pactest/pmenv.py
@@ -104,11 +104,16 @@ class pmenv:
fail = test.result["fail"]
rules = len(test.rules)
if fail == 0:
- print "[PASSED]",
+ result = "[PASSED]"
else:
- print "[FAILED]",
+ result = "[FAILED]"
+ print result,
print "%s Rules: OK = %2u FAIL = %2u SKIP = %2u" \
- % (test.testname.ljust(32), success, fail, rules - (success + fail))
+ % (test.testname.ljust(32), success, fail, \
+ rules - (success + fail))
+ if fail != 0:
+ # print test description if test failed
+ print " ", test.description
print "=========="*8
print "Results"
diff --git a/pactest/pmfile.py b/pactest/pmfile.py
index 71a0cd7c..99b14a8b 100755
--- a/pactest/pmfile.py
+++ b/pactest/pmfile.py
@@ -52,8 +52,8 @@ class pmfile:
vprint("\t\told: %s / %s" % (self.checksum, self.mtime))
vprint("\t\tnew: %s / %s" % (checksum, mtime))
- if not self.checksum == checksum \
- or not (self.mtime[1], self.mtime[2]) == (mtime[1], mtime[2]):
+ if self.checksum != checksum \
+ or (self.mtime[1], self.mtime[2]) != (mtime[1], mtime[2]):
retval = 1
return retval
diff --git a/pactest/pmrule.py b/pactest/pmrule.py
index 33a29f0e..dc04cf1a 100755
--- a/pactest/pmrule.py
+++ b/pactest/pmrule.py
@@ -86,7 +86,7 @@ class pmrule:
if not value in newpkg.requiredby:
success = 0
elif case == "REASON":
- if not newpkg.reason == int(value):
+ if newpkg.reason != int(value):
success = 0
elif case == "FILES":
if not value in newpkg.files:
diff --git a/pactest/util.py b/pactest/util.py
index a633e869..2b384098 100755
--- a/pactest/util.py
+++ b/pactest/util.py
@@ -62,7 +62,7 @@ def getfilename(name):
"""
filename = ""
link = ""
- if not name.find(" -> ") == -1:
+ if name.find(" -> ") != -1:
filename, link = name.split(" -> ")
elif name[-1] == "*":
filename = name.rstrip("*")
@@ -80,7 +80,7 @@ def mkfile(name, data = ""):
link = ""
filename = ""
- if not name.find(" -> ") == -1:
+ if name.find(" -> ") != -1:
islink = 1
filename, link = name.split(" -> ")
elif name[-1] == "*":
@@ -181,8 +181,9 @@ def mkcfgfile(filename, root, option, db):
# Repositories
data.extend(["[%s]\n" \
"server = file://%s\n" \
- % (value.treename, os.path.join(root, SYNCREPO, value.treename)) \
- for key, value in db.iteritems() if not key == "local"])
+ % (value.treename, \
+ os.path.join(root, SYNCREPO, value.treename)) \
+ for key, value in db.iteritems() if key != "local"])
mkfile(os.path.join(root, filename), "\n".join(data))