summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@canonical.com>2010-06-25 15:24:27 +0200
committerMartin Pitt <martin.pitt@canonical.com>2010-06-25 15:24:27 +0200
commit2c39f0847c8f32b93cac8d450d30b657548bafd4 (patch)
treebbdc11d2c8020a304a832d21e0431580aa44afb7 /tests
parentd6cc940087ee8897bad4e6a25d04403d28c5dc0a (diff)
downloadpython-apt-2c39f0847c8f32b93cac8d450d30b657548bafd4.tar.gz
tests/test_apt_cache.py: Test accessing the record of all packages during
iteration. This both ensures that it's well-formatted and structured, and also that accessing it does not take an inordinate amount of time. This exposes a severe performance problem when using gzip compressed package indexes.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_apt_cache.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index fdcf482d..a00fa08b 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -30,5 +30,14 @@ class TestAptCache(unittest.TestCase):
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()