summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-06-29 11:02:42 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-06-29 11:02:42 +0200
commitcdaebccd5f7a5a0e23a9be7989b64850fabafed1 (patch)
tree52d3bd94c02ae9be75fb11bfd423043ef10838cc /tests
parent57624b5df523c0b3a3ebc1741680f283ee1fbbcd (diff)
parent340f6a3d54f5705801267f365fb08b5d20228fe6 (diff)
downloadpython-apt-cdaebccd5f7a5a0e23a9be7989b64850fabafed1.tar.gz
merged from debian-sid
Diffstat (limited to 'tests')
-rw-r--r--[-rwxr-xr-x]tests/old/memleak.py0
-rw-r--r--tests/test_apt_cache.py19
2 files changed, 14 insertions, 5 deletions
diff --git a/tests/old/memleak.py b/tests/old/memleak.py
index 5299f35f..5299f35f 100755..100644
--- a/tests/old/memleak.py
+++ b/tests/old/memleak.py
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index 3c2961e1..a00fa08b 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -15,9 +15,9 @@ class TestAptCache(unittest.TestCase):
""" test the apt cache """
def testAptCache(self):
- """ simple test that iterates all packages and all dependencies """
+ """cache: iterate all packages and all dependencies """
cache = apt.Cache()
- # number is not meaningful and just need to be "big enough",
+ # number is not meaningful and just need to be "big enough",
# the important bit is the test against __len__
self.assertTrue(len(cache) > 100)
# go over the cache and all dependencies, just to see if
@@ -26,9 +26,18 @@ class TestAptCache(unittest.TestCase):
if pkg.candidate:
for or_dep in pkg.candidate.dependencies:
for dep in or_dep.or_dependencies:
- name = dep.name
- relation = dep.relation
- preDepends = dep.pre_depend
+ self.assertTrue(dep.name)
+ self.assertTrue(isinstance(dep.relation, str))
+ self.assertTrue(dep.pre_depend in (True, False))
+
+ # accessing record should take a reasonable time; in
+ # particular, when using compressed indexes, it should not use
+ # tons of seek operations
+ r = pkg.candidate.record
+ self.assertEqual(r['Package'], pkg.name)
+ self.assert_('Version' in r)
+ self.assert_(len(r['Description']) > 0)
+ self.assert_(str(r).startswith('Package: %s\n' % pkg.name))
if __name__ == "__main__":
unittest.main()