summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-08-08 13:06:26 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-08-08 13:06:26 +0200
commitc44f1fc99e2afd12c79825cdb8e7d287d400bba7 (patch)
treeb1e30437fd00d04f4a7b8027b82e13bf2c114e0d
parentf72bdc92aac842ccaa406a96f8bfbad1cc9a2835 (diff)
parent2fa02f88701da8277e6082942b928031a10cc08c (diff)
downloadpython-apt-c44f1fc99e2afd12c79825cdb8e7d287d400bba7.tar.gz
merge from the debian-sid branch
-rw-r--r--debian/changelog19
-rw-r--r--tests/test_apt_cache.py31
2 files changed, 35 insertions, 15 deletions
diff --git a/debian/changelog b/debian/changelog
index 87a09438..d0d0c338 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,22 @@
+python-apt (0.8.1) UNRELEASED; urgency=low
+
+ [ Julian Andres Klode ]
+ * Breaks: debsecan (<< 0.4.15) [not only << 0.4.14] (Closes: #629512)
+
+ [ Michael Vogt ]
+ * python/arfile.cc:
+ - use APT::Configuration::getCompressionTypes() instead of duplicating
+ the supported methods here
+ * tests/test_debfile.py:
+ - add test for raise on unknown data.tar.xxx
+ * tests/test_aptsources_ports.py, tests/test_aptsources.py:
+ - use tmpdir during the tests to fix test failure with apt from
+ experimental
+ * tests/test_apt_cache.py:
+ - fix test by providing proper fixture data
+
+ -- Julian Andres Klode <jak@debian.org> Tue, 07 Jun 2011 14:00:22 +0200
+
python-apt (0.8.0ubuntu1) UNRELEASED; urgency=low
[ Julian Andres Klode ]
diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py
index 602043a8..916a43cb 100644
--- a/tests/test_apt_cache.py
+++ b/tests/test_apt_cache.py
@@ -17,6 +17,7 @@ sys.path.insert(0, get_library_dir())
import apt
import apt_pkg
+import copy
import shutil
import glob
@@ -26,6 +27,14 @@ class TestAptCache(unittest.TestCase):
def setUp(self):
# reset any config manipulations done in the individual tests
apt_pkg.init_config()
+ # save/restore the apt config
+ self._cnf = {}
+ for item in apt_pkg.config.keys():
+ self._cnf[item] = apt_pkg.config.find(item)
+
+ def tearDown(self):
+ for item in self._cnf:
+ apt_pkg.config.set(item, self._cnf[item])
def test_apt_cache(self):
"""cache: iterate all packages and all dependencies """
@@ -53,25 +62,21 @@ class TestAptCache(unittest.TestCase):
self.assertTrue(str(r).startswith('Package: %s\n' % pkg.shortname))
def test_get_provided_packages(self):
- cache = apt.Cache()
+ apt.apt_pkg.config.set("Apt::architecture", "i386")
+ cache = apt.Cache(rootdir="./data/test-provides/")
+ cache.open()
# a true virtual pkg
l = cache.get_providing_packages("mail-transport-agent")
self.assertTrue(len(l) > 0)
self.assertTrue("postfix" in [p.name for p in l])
- # FIXME: this is failing currently, create a better (artificial)
- # testcase for this feature
- # this is a not virtual (transitional) package provided by another
- #l = cache.get_providing_packages("git-core")
- #self.assertEqual(l, [])
- # now inlcude nonvirtual packages in the search
- l = cache.get_providing_packages("git-core",
- include_nonvirtual=True)
- self.assertEqual([p.name for p in l], ["git"])
self.assertTrue("mail-transport-agent" in cache["postfix"].candidate.provides)
def test_low_level_pkg_provides(self):
+ apt.apt_pkg.config.set("Apt::architecture", "i386")
+ # create highlevel cache and get the lowlevel one from it
+ highlevel_cache = apt.Cache(rootdir="./data/test-provides")
# low level cache provides list of the pkg
- cache = apt_pkg.Cache(progress=None)
+ cache = highlevel_cache._cache
l = cache["mail-transport-agent"].provides_list
# arbitrary number, just needs to be higher enough
self.assertTrue(len(l) > 5)
@@ -84,8 +89,6 @@ class TestAptCache(unittest.TestCase):
def test_dpkg_journal_dirty(self):
- # backup old value
- old_status = apt_pkg.config.find_file("Dir::State::status")
# create tmp env
tmpdir = tempfile.mkdtemp()
dpkg_dir = os.path.join(tmpdir,"var","lib","dpkg")
@@ -102,8 +105,6 @@ class TestAptCache(unittest.TestCase):
# that is a dirty journal
open(os.path.join(dpkg_dir,"updates","000"), "w").close()
self.assertTrue(cache.dpkg_journal_dirty)
- # reset config value
- apt_pkg.config.set("Dir::State::status", old_status)
def test_apt_update(self):
rootdir = "./data/tmp"