summaryrefslogtreecommitdiff
path: root/tests/pkgrecords.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-05-04 08:36:36 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-05-04 08:36:36 +0000
commit69a3c876af74e2499b5068441b5d89ca53c3583a (patch)
treefad0d73c9c71a606a37fc5c9552aa56df48ab6f2 /tests/pkgrecords.py
parent52ecc81517a1fa9748d04f0c0d05ce8396233b71 (diff)
downloadpython-apt-69a3c876af74e2499b5068441b5d89ca53c3583a.tar.gz
* more tests added
* tests/cache.py: - test that iterates over all the cache and dependencies * tests/pkgrecords.py - test that iterates over all the pkgrecords * python/cache.cc - added a comment * python/pkgrecords.cc - return "True" from pkgRecord.Lookup() (to make it consistent with the PkgSrcRecords object)
Diffstat (limited to 'tests/pkgrecords.py')
-rw-r--r--tests/pkgrecords.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/pkgrecords.py b/tests/pkgrecords.py
new file mode 100644
index 00000000..8bfe4b82
--- /dev/null
+++ b/tests/pkgrecords.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python2.4
+#
+# Test for the PkgSrcRecords code
+# it segfaults for python-apt < 0.5.37
+#
+
+import apt_pkg
+import sys
+
+def main():
+ apt_pkg.init()
+ cache = apt_pkg.GetCache()
+ depcache = apt_pkg.GetDepCache(cache)
+ depcache.Init()
+ i=0
+ print "Running PkgRecords test on all packages:"
+ for pkg in cache.Packages:
+ i += 1
+ records = apt_pkg.GetPkgRecords(cache)
+ if len(pkg.VersionList) == 0:
+ #print "no available version, cruft"
+ continue
+ version = depcache.GetCandidateVer(pkg)
+ file, index = version.FileList.pop(0)
+ if records.Lookup((file,index)):
+ #print records.FileName
+ x = records.FileName
+ y = records.LongDesc
+ pass
+ print "\r%i/%i=%.3f%% " % (i,cache.PackageCount, (float(i)/float(cache.PackageCount)*100)),
+
+if __name__ == "__main__":
+ main()
+ sys.exit(0)