From 1da80475cabf37da411aff8983d427773cfc0a80 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 26 Aug 2010 14:08:02 +0200 Subject: * tests/test_apt_cache.py: - Do not insert ".." into sys.path, fixes FTBFS --- tests/test_apt_cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/test_apt_cache.py') diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index a43e92d2..81d64bc6 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -10,8 +10,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 -- cgit v1.2.3 From 33bbf9482fe486aab915768fc74609d303c1e1f9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 31 Aug 2010 17:19:27 +0200 Subject: tests/test_apt_cache.py: add test for provides_list --- tests/test_apt_cache.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests/test_apt_cache.py') diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 44b95cab..d6a2cbd4 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -62,7 +62,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 -- cgit v1.2.3 From b410a7e17e3a255127ef054b9a867354face49f3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 8 Sep 2010 10:54:12 +0200 Subject: fix a bunch of python3.1 releated test failures --- tests/test_apt_cache.py | 4 ++-- tests/test_aptsources.py | 4 ++-- tests/test_debfile.py | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'tests/test_apt_cache.py') diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index e020b2e5..efa73a4f 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -106,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..e56761f3 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -18,8 +18,8 @@ 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"): - self.templates = os.path.abspath("../build/data/templates") + if 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 ") 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")) -- cgit v1.2.3