diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-08-08 12:06:28 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-08-08 12:06:28 +0200 |
| commit | f72bdc92aac842ccaa406a96f8bfbad1cc9a2835 (patch) | |
| tree | 78f868424ee2da34ffa7c4d1d5169d43710e9e38 | |
| parent | 92fa20d43ed81ef27f45dfb2ed59c7d3d69d4fe7 (diff) | |
| parent | 0b74c98e4a583c491a3516e27dcce5d0dbaa0144 (diff) | |
| download | python-apt-f72bdc92aac842ccaa406a96f8bfbad1cc9a2835.tar.gz | |
merged from debian
| -rw-r--r-- | tests/test_apt_cache.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 399d50dd..602043a8 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -27,7 +27,7 @@ class TestAptCache(unittest.TestCase): # reset any config manipulations done in the individual tests apt_pkg.init_config() - def testAptCache(self): + def test_apt_cache(self): """cache: iterate all packages and all dependencies """ cache = apt.Cache() # number is not meaningful and just need to be "big enough", @@ -74,7 +74,7 @@ class TestAptCache(unittest.TestCase): cache = apt_pkg.Cache(progress=None) l = cache["mail-transport-agent"].provides_list # arbitrary number, just needs to be higher enough - self.assertTrue(len(l), 5) + self.assertTrue(len(l) > 5) for (providesname, providesver, version) in l: self.assertEqual(providesname, "mail-transport-agent") if version.parent_pkg.name == "postfix": @@ -115,9 +115,12 @@ class TestAptCache(unittest.TestCase): pass state_dir = os.path.join(rootdir, "var/lib/apt") lists_dir = os.path.join(rootdir, "var/lib/apt/lists") + old_state = apt_pkg.config.find("dir::state") apt_pkg.config.set("dir::state", state_dir) # set a local sources.list that does not need the network base_sources = os.path.abspath(os.path.join(rootdir, "sources.list")) + old_source_list = apt_pkg.config.find("dir::etc::sourcelist") + old_source_parts = apt_pkg.config.find("dir::etc::sourceparts") apt_pkg.config.set("dir::etc::sourcelist", base_sources) apt_pkg.config.set("dir::etc::sourceparts", "xxx") # main sources.list @@ -163,6 +166,9 @@ class TestAptCache(unittest.TestCase): cache.update(sources_list=sources_list) all_packages = glob.glob(lists_dir+"/*_Packages*") self.assertEqual(len(all_packages), 2) + apt_pkg.config.set("dir::state", old_state) + apt_pkg.config.set("dir::etc::sourcelist", old_source_list) + apt_pkg.config.set("dir::etc::sourceparts", old_source_parts) if __name__ == "__main__": unittest.main() |
