From 8b7f77302ccf3d71e66ac5cadea658e3dcdd8958 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 23 Mar 2010 14:34:37 +0100 Subject: * tests/data/aptsources_ports/sources.list: - fix ports test-data --- tests/data/aptsources_ports/sources.list | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3 From 05b659d926b999015db3c47c7e5335093d9cbfff Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 23 Mar 2010 15:19:14 +0100 Subject: * tests/test_apt_cache.py: - add simple test for basic cache/dependency iteration --- debian/changelog | 2 ++ tests/test_apt_cache.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/test_apt_cache.py (limited to 'tests') diff --git a/debian/changelog b/debian/changelog index cd216e3e..e780727e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ python-apt (0.7.94.3) UNRELEASED; urgency=low - 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 Mon, 15 Mar 2010 17:04:49 +0100 diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py new file mode 100644 index 00000000..3c2961e1 --- /dev/null +++ b/tests/test_apt_cache.py @@ -0,0 +1,34 @@ +#!/usr/bin/python +# +# Copyright (C) 2010 Julian Andres Klode +# +# 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): + """ simple test that iterates 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: + name = dep.name + relation = dep.relation + preDepends = dep.pre_depend + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3