summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-03-23 15:19:14 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-03-23 15:19:14 +0100
commit05b659d926b999015db3c47c7e5335093d9cbfff (patch)
treeb848755cf1212aaf3c58b5d7a56c0b0028040d6a
parent8b7f77302ccf3d71e66ac5cadea658e3dcdd8958 (diff)
downloadpython-apt-05b659d926b999015db3c47c7e5335093d9cbfff.tar.gz
* tests/test_apt_cache.py:
- add simple test for basic cache/dependency iteration
-rw-r--r--debian/changelog2
-rw-r--r--tests/test_apt_cache.py34
2 files changed, 36 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index cd216e3e..e780727e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ python-apt (0.7.94.3) UNRELEASED; urgency=low
- make cache open silent by default (use apt.progress.base.OpProgress)
* tests/data/aptsources_ports/sources.list:
- fix ports test-data
+ * tests/test_apt_cache.py:
+ - add simple test for basic cache/dependency iteration
-- Julian Andres Klode <jak@debian.org> Mon, 15 Mar 2010 17:04:49 +0100
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
new file mode 100644
index 00000000..3c2961e1
--- /dev/null
+++ b/tests/test_apt_cache.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2010 Julian Andres Klode <jak@debian.org>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+"""Unit tests for verifying the correctness of check_dep, etc in apt_pkg."""
+import unittest
+
+import apt
+
+
+class TestAptCache(unittest.TestCase):
+ """ test the apt cache """
+
+ def testAptCache(self):
+ """ simple test that iterates all packages and all dependencies """
+ cache = apt.Cache()
+ # 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
+ # that is possible and does not crash
+ for pkg in cache:
+ 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
+
+if __name__ == "__main__":
+ unittest.main()