diff options
| author | Julian Andres Klode <jak@debian.org> | 2009-01-12 17:01:34 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2009-01-12 17:01:34 +0100 |
| commit | 2e4443bbd9872f5599c9a8eb93a65d6c34c83ca2 (patch) | |
| tree | 86e6f869f2f0e59f99df0f49f679dcd7eeba5255 /tests | |
| parent | eb32fb89da3e3e1ff4a9668aaed6d533f04e9ee7 (diff) | |
| download | python-apt-2e4443bbd9872f5599c9a8eb93a65d6c34c83ca2.tar.gz | |
Cleanup: Comparisons to True/False, ==/!= None, deprecated modules
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/depcache.py | 2 | ||||
| -rw-r--r-- | tests/pkgproblemresolver.py | 2 | ||||
| -rw-r--r-- | tests/test_aptsources_ports.py | 18 | ||||
| -rwxr-xr-x | tests/test_debextract.py | 19 |
4 files changed, 25 insertions, 16 deletions
diff --git a/tests/depcache.py b/tests/depcache.py index b199c812..19aba680 100644 --- a/tests/depcache.py +++ b/tests/depcache.py @@ -22,7 +22,7 @@ def main(): x = pkg.Name # then get each version ver =depcache.GetCandidateVer(pkg) - if ver != None: + if ver is not None: depcache.MarkInstall(pkg) if depcache.InstCount == 0: if depcache.IsUpgradable(pkg): diff --git a/tests/pkgproblemresolver.py b/tests/pkgproblemresolver.py index 7d5ae682..a21d8d9d 100644 --- a/tests/pkgproblemresolver.py +++ b/tests/pkgproblemresolver.py @@ -22,7 +22,7 @@ def main(): x = pkg.Name # then get each version ver =depcache.GetCandidateVer(pkg) - if ver != None: + if ver is not None: depcache.MarkInstall(pkg) if depcache.BrokenCount > 0: fixer = apt_pkg.GetPkgProblemResolver(depcache) diff --git a/tests/test_aptsources_ports.py b/tests/test_aptsources_ports.py index 203721c7..09d6e9d9 100644 --- a/tests/test_aptsources_ports.py +++ b/tests/test_aptsources_ports.py @@ -1,28 +1,32 @@ #!/usr/bin/env python import unittest -import apt_pkg + import os import copy - import sys + sys.path.insert(0, "../") +import apt_pkg import aptsources import aptsources.sourceslist import aptsources.distro + class TestAptSources(unittest.TestCase): + def __init__(self, methodName): unittest.TestCase.__init__(self, methodName) apt_pkg.init() - apt_pkg.Config.Set("APT::Architecture","powerpc") - apt_pkg.Config.Set("Dir::Etc", os.path.join(os.getcwd(),"test-data-ports")) - apt_pkg.Config.Set("Dir::Etc::sourceparts","/xxx") + apt_pkg.Config.Set("APT::Architecture", "powerpc") + apt_pkg.Config.Set("Dir::Etc", os.path.abspath("test-data-ports")) + apt_pkg.Config.Set("Dir::Etc::sourceparts", "/xxx") def testMatcher(self): - apt_pkg.Config.Set("Dir::Etc::sourcelist","sources.list") + apt_pkg.Config.Set("Dir::Etc::sourcelist", "sources.list") sources = aptsources.sourceslist.SourcesList() - distro = aptsources.distro.get_distro("Ubuntu","hardy","desc","8.04") + distro = aptsources.distro.get_distro("Ubuntu", "hardy", "desc", + "8.04") distro.get_sources(sources) # test if all suits of the current distro were detected correctly dist_templates = set() diff --git a/tests/test_debextract.py b/tests/test_debextract.py index c080b26e..4ba498ae 100755 --- a/tests/test_debextract.py +++ b/tests/test_debextract.py @@ -1,13 +1,18 @@ #!/usr/bin/python +import sys import apt_inst -import sys -def Callback(What,Name,Link,Mode,UID,GID,Size,MTime,Major,Minor): + +def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor): print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" % ( - What,Name,Link,Mode,UID,GID,Size, MTime, Major, Minor) + What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor) + + +def main(): + member = "data.tar.lzma" + if len(sys.argv) > 2: + member = sys.argv[2] + apt_inst.debExtract(open(sys.argv[1]), Callback, member) -member = "data.tar.lzma" -if len(sys.argv) > 2: - member = sys.argv[2] -apt_inst.debExtract(open(sys.argv[1]), Callback, member) +main() |
