summaryrefslogtreecommitdiff
path: root/tests/pkgproblemresolver.py
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-17 19:40:47 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-17 19:40:47 +0200
commitcbd822c9dfe8cf18d828bd558290f15775b4d837 (patch)
treeb9ee1d702dd85a5dc2cbd9303e7f31ca6b8ffa52 /tests/pkgproblemresolver.py
parent9bd7c1dcf9942d6ce294aa5ac58d90d6c1aa9f51 (diff)
downloadpython-apt-cbd822c9dfe8cf18d828bd558290f15775b4d837.tar.gz
tests: First work on the new testsuite.
The module tests.test_all will run all available tests. Each test placed herein must be using unittest and provide at least 1 test case. It must be prefixed with test_.
Diffstat (limited to 'tests/pkgproblemresolver.py')
-rw-r--r--tests/pkgproblemresolver.py70
1 files changed, 0 insertions, 70 deletions
diff --git a/tests/pkgproblemresolver.py b/tests/pkgproblemresolver.py
deleted file mode 100644
index 0d6d0611..00000000
--- a/tests/pkgproblemresolver.py
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/env python2.4
-#
-# Test for the DepCache code
-#
-
-import apt_pkg
-import sys
-
-
-def main():
- apt_pkg.init()
- cache = apt_pkg.Cache()
- depcache = apt_pkg.DepCache(cache)
- depcache.Init()
- i=0
- all=cache.PackageCount
- print "Running DepCache test on all packages"
- print "(trying to install each and then mark it keep again):"
- # first, get all pkgs
- for pkg in cache.Packages:
- i += 1
- x = pkg.Name
- # then get each version
- ver =depcache.GetCandidateVer(pkg)
- if ver is not None:
- depcache.MarkInstall(pkg)
- if depcache.BrokenCount > 0:
- fixer = apt_pkg.ProblemResolver(depcache)
- fixer.Clear(pkg)
- fixer.Protect(pkg)
- # we first try to resolve the problem
- # with the package that should be installed
- # protected
- try:
- fixer.Resolve(True)
- except SystemError:
- # the pkg seems to be broken, the
- # returns a exception
- fixer.Clear(pkg)
- fixer.Resolve(True)
- if not depcache.MarkedInstall(pkg):
- print "broken in archive: %s " % pkg.Name
- fixer = None
- if depcache.InstCount == 0:
- if depcache.IsUpgradable(pkg):
- print "Error marking %s for install" % x
- for p in cache.Packages:
- if depcache.MarkedInstall(p) or depcache.MarkedUpgrade(p):
- depcache.MarkKeep(p)
- if depcache.InstCount != 0:
- print "Error undoing the selection for %s" % x
- print "\r%i/%i=%.3f%% " % (i, all, (float(i) / float(all) * 100)),
-
- print
- print "Trying Upgrade:"
- depcache.Upgrade()
- print "To install: %s " % depcache.InstCount
- print "To remove: %s " % depcache.DelCount
- print "Kept back: %s " % depcache.KeepCount
-
- print "Trying DistUpgrade:"
- depcache.Upgrade(True)
- print "To install: %s " % depcache.InstCount
- print "To remove: %s " % depcache.DelCount
- print "Kept back: %s " % depcache.KeepCount
-
-
-if __name__ == "__main__":
- main()
- sys.exit(0)