diff options
| -rw-r--r-- | apt/cache.py | 2 | ||||
| -rw-r--r-- | debian/changelog | 10 | ||||
| -rw-r--r-- | python/generic.cc | 1 | ||||
| -rw-r--r-- | tests/data/aptsources_ports/sources.list | 16 | ||||
| -rw-r--r-- | tests/test_apt_cache.py | 34 |
5 files changed, 54 insertions, 9 deletions
diff --git a/apt/cache.py b/apt/cache.py index 2e6d24e5..cfe6bedc 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -117,7 +117,7 @@ class Cache(object): a dictionary """ if progress is None: - progress = apt.progress.text.OpProgress() + progress = apt.progress.base.OpProgress() self._run_callbacks("cache_pre_open") self._cache = apt_pkg.Cache(progress) diff --git a/debian/changelog b/debian/changelog index b7617f90..69eecc2b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,20 @@ python-apt (0.7.94.3) UNRELEASED; urgency=low + [ Julian Andres Klode ] * python/generic.cc: - Fix a memory leak when using old attribute names. + - Map ArchiveURI property to archive_uri * debian/control: - Change priority to standard, keep -doc and -dev on optional. + [ Michael Vogt ] + * apt/cache.py: + - 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 python-apt (0.7.94.2) unstable; urgency=low diff --git a/python/generic.cc b/python/generic.cc index 1c68a481..e04743ff 100644 --- a/python/generic.cc +++ b/python/generic.cc @@ -63,6 +63,7 @@ static PyObject *_PyApt_NewNameForAttribute(const char *attr) { if (strcasecmp(attr, "ReadPinFile") == 0) return PyString_FromString("read_pinfile"); if (strcasecmp(attr, "SetReInstall") == 0) return PyString_FromString("set_reinstall"); if (strcasecmp(attr, "URI") == 0) return PyString_FromString("uri"); + if (strcasecmp(attr, "ArchiveURI") == 0) return PyString_FromString("archive_uri"); if (strcasecmp(attr, "MD5Hash") == 0) return PyString_FromString("md5_hash"); if (strcasecmp(attr, "SHA1Hash") == 0) return PyString_FromString("sha1_hash"); if (strcasecmp(attr, "SHA256Hash") == 0) return PyString_FromString("sha256_hash"); diff --git a/tests/data/aptsources_ports/sources.list b/tests/data/aptsources_ports/sources.list index a6b2f6ed..54f048b2 100644 --- a/tests/data/aptsources_ports/sources.list +++ b/tests/data/aptsources_ports/sources.list @@ -6,12 +6,12 @@ # newer versions of the distribution. deb http://ports.ubuntu.com/ubuntu-ports/ hardy main restricted -deb-src http://archive.ubuntu.com/ubuntu hardy main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://ports.ubuntu.com/ubuntu-ports/ hardy-updates main restricted -deb-src http://archive.ubuntu.com/ubuntu hardy-updates main restricted +deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to @@ -19,9 +19,9 @@ deb-src http://archive.ubuntu.com/ubuntu hardy-updates main restricted ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. deb http://ports.ubuntu.com/ubuntu-ports/ hardy universe -deb-src http://archive.ubuntu.com/ubuntu hardy universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy universe deb http://ports.ubuntu.com/ubuntu-ports/ hardy-updates universe -deb-src http://archive.ubuntu.com/ubuntu hardy-updates universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to @@ -29,9 +29,9 @@ deb-src http://archive.ubuntu.com/ubuntu hardy-updates universe ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://ports.ubuntu.com/ubuntu-ports/ hardy multiverse -deb-src http://archive.ubuntu.com/ubuntu hardy multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy multiverse deb http://ports.ubuntu.com/ubuntu-ports/ hardy-updates multiverse -deb-src http://archive.ubuntu.com/ubuntu hardy-updates multiverse +deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-updates multiverse ## Uncomment the following two lines to add software from the 'backports' ## repository. @@ -41,7 +41,7 @@ deb-src http://archive.ubuntu.com/ubuntu hardy-updates multiverse ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. # deb http://ports.ubuntu.com/ubuntu-ports/ hardy-backports main restricted universe multiverse -# deb-src http://archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse +# deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. This software is not part of Ubuntu, but is @@ -56,4 +56,4 @@ deb http://ports.ubuntu.com/ubuntu-ports/ hardy-security universe deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-security universe deb http://ports.ubuntu.com/ubuntu-ports/ hardy-security multiverse deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-security multiverse -deb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed restricted main multiverse universe +deb-src http://ports.ubuntu.com/ubuntu-ports/ hardy-proposed restricted main multiverse universe diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py new file mode 100644 index 00000000..fdcf482d --- /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): + """cache: iterate 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: + self.assertTrue(dep.name) + self.assertTrue(isinstance(dep.relation, str)) + self.assertTrue(dep.pre_depend in (True, False)) + +if __name__ == "__main__": + unittest.main() |
