summaryrefslogtreecommitdiff
path: root/tests/test_apt_cache.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-09-28 16:24:46 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-09-28 16:24:46 +0200
commitd6fafe4e9e106547910ef759573a86e1a582bc73 (patch)
treeab710a8c9b20372061324948e5396faae19715ad /tests/test_apt_cache.py
parent2d771cd542128fa347c353ddb6cdad5a684652f3 (diff)
parentec2fa33ed76e14e14d9c7d78f008147c6e10475c (diff)
downloadpython-apt-d6fafe4e9e106547910ef759573a86e1a582bc73.tar.gz
merged from the debian-sid branch
Diffstat (limited to 'tests/test_apt_cache.py')
-rw-r--r--tests/test_apt_cache.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index a5b52ea3..efa73a4f 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -11,8 +11,9 @@ import os
import tempfile
import unittest
+from test_all import get_library_dir
import sys
-sys.path.insert(0, "..")
+sys.path.insert(0, get_library_dir())
import apt
import apt_pkg
@@ -65,7 +66,20 @@ class TestAptCache(unittest.TestCase):
include_nonvirtual=True)
self.assertTrue(len(l), 1)
self.assertTrue("mail-transport-agent" in cache["postfix"].candidate.provides)
-
+
+ def test_low_level_pkg_provides(self):
+ # low level cache provides list of the pkg
+ cache = apt_pkg.Cache()
+ l = cache["mail-transport-agent"].provides_list
+ # arbitrary number, just needs to be higher enough
+ self.assertTrue(len(l), 5)
+ for (providesname, providesver, version) in l:
+ self.assertEqual(providesname, "mail-transport-agent")
+ if version.parent_pkg.name == "postfix":
+ break
+ else:
+ self.assertNotReached()
+
def test_dpkg_journal_dirty(self):
# backup old value
@@ -92,10 +106,10 @@ class TestAptCache(unittest.TestCase):
def test_apt_update(self):
rootdir = "./data/tmp"
if os.path.exists(rootdir):
- shutil.rmtree(rootdir)
+ shutil.rmtree(rootdir)
try:
os.makedirs(os.path.join(rootdir, "var/lib/apt/lists/partial"))
- except OSError, e:
+ except OSError:
pass
state_dir = os.path.join(rootdir, "var/lib/apt")
lists_dir = os.path.join(rootdir, "var/lib/apt/lists")