summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-07-02 14:50:52 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-07-02 14:50:52 +0200
commit03ce5718b828ade3940a8dd6c57a639f0d853cfc (patch)
tree7ca419cb5d6eee52c3302757ee8d40fb40a3b1cb /tests
parenta90b26aad2824d4bd224586cdf14c0ad21059ac3 (diff)
parent0c4bbfa36f36d42cc3d700e58d531e05ba898e0e (diff)
downloadpython-apt-03ce5718b828ade3940a8dd6c57a639f0d853cfc.tar.gz
merged lp:~kiwinote/python-apt/merge-gdebi-changes, this port the
DebPackage class fixes from gdebi into python-apt so that gdebi can use the class from python-apt directly
Diffstat (limited to 'tests')
-rw-r--r--tests/test_apt_cache.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index b27ed778..653a0f48 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -6,12 +6,15 @@
# 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 os
+import tempfile
import unittest
+import sys
+sys.path.insert(0, "..")
+
import apt
import apt_pkg
-import os
-import tempfile
class TestAptCache(unittest.TestCase):
@@ -42,6 +45,21 @@ class TestAptCache(unittest.TestCase):
self.assert_(len(r['Description']) > 0)
self.assert_(str(r).startswith('Package: %s\n' % pkg.name))
+ def test_get_provided_packages(self):
+ cache = apt.Cache()
+ # a true virtual pkg
+ l = cache.get_providing_packages("mail-transport-agent")
+ self.assertTrue(len(l) > 0)
+ # this is a not virtual (transitional) package provided by another
+ l = cache.get_providing_packages("scrollkeeper")
+ self.assertEqual(l, [])
+ # now inlcude nonvirtual packages in the search (rarian-compat
+ # provides scrollkeeper)
+ l = cache.get_providing_packages("scrollkeeper",
+ include_nonvirtual=True)
+ self.assertTrue(len(l), 1)
+
+
def test_dpkg_journal_dirty(self):
# backup old value
old_status = apt_pkg.Config.find_file("Dir::State::status")