diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-09-28 16:24:46 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-09-28 16:24:46 +0200 |
| commit | d6fafe4e9e106547910ef759573a86e1a582bc73 (patch) | |
| tree | ab710a8c9b20372061324948e5396faae19715ad /tests | |
| parent | 2d771cd542128fa347c353ddb6cdad5a684652f3 (diff) | |
| parent | ec2fa33ed76e14e14d9c7d78f008147c6e10475c (diff) | |
| download | python-apt-d6fafe4e9e106547910ef759573a86e1a582bc73.tar.gz | |
merged from the debian-sid branch
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_apt_cache.py | 22 | ||||
| -rw-r--r-- | tests/test_aptsources.py | 4 | ||||
| -rw-r--r-- | tests/test_debfile.py | 5 |
3 files changed, 26 insertions, 5 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") diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 3ef20f64..331df935 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -18,7 +18,9 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("APT::Architecture", "i386") apt_pkg.config.set("Dir::Etc", os.getcwd()) apt_pkg.config.set("Dir::Etc::sourceparts", "/xxx") - if os.path.exists("../build/data/templates"): + if os.path.exists("./build/data/templates"): + self.templates = os.path.abspath("./build/data/templates") + elif os.path.exists("../build/data/templates"): self.templates = os.path.abspath("../build/data/templates") else: self.templates = "/usr/share/python-apt/templates/" diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 571c2ec9..759639c4 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -85,6 +85,11 @@ class TestDebfilee(unittest.TestCase): "Samuel Lidén Borell <samuel@slbdata.se>") def testContent(self): + # no python-debian for python3 yet, so fail gracefully + try: + import debian + except ImportError: + return # normal deb = apt.debfile.DebPackage(cache=self.cache) deb.open(os.path.join("data", "test_debs", "gdebi-test11.deb")) |
