From 2c39f0847c8f32b93cac8d450d30b657548bafd4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 25 Jun 2010 15:24:27 +0200 Subject: tests/test_apt_cache.py: Test accessing the record of all packages during iteration. This both ensures that it's well-formatted and structured, and also that accessing it does not take an inordinate amount of time. This exposes a severe performance problem when using gzip compressed package indexes. --- tests/test_apt_cache.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index fdcf482d..a00fa08b 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -30,5 +30,14 @@ class TestAptCache(unittest.TestCase): self.assertTrue(isinstance(dep.relation, str)) self.assertTrue(dep.pre_depend in (True, False)) + # accessing record should take a reasonable time; in + # particular, when using compressed indexes, it should not use + # tons of seek operations + r = pkg.candidate.record + self.assertEqual(r['Package'], pkg.name) + self.assert_('Version' in r) + self.assert_(len(r['Description']) > 0) + self.assert_(str(r).startswith('Package: %s\n' % pkg.name)) + if __name__ == "__main__": unittest.main() -- cgit v1.2.3 From 508f1ddb5b6a0cc69655e39dbd59fe3466173a84 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 29 Jun 2010 11:23:31 +0200 Subject: * apt/cache.py: - add new "dpkg_journal_dirty" property that can be used to detect a interrupted dpkg (the famous "E: dpkg was interrupted, you must manually run 'dpkg --configure -a'") --- apt/cache.py | 15 +++++++++++++++ debian/changelog | 4 ++++ tests/test_apt_cache.py | 26 ++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) (limited to 'tests') diff --git a/apt/cache.py b/apt/cache.py index 3679e4ba..3962bb4f 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -19,6 +19,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA +import fnmatch import os import weakref @@ -454,6 +455,20 @@ class Cache(object): """ return apt_pkg.ActionGroup(self._depcache) + @property + def dpkg_journal_dirty(self): + """Return True if the dpkg was interrupted + + All dpkg operations will fail until this is fixed, the action to + fix the system if dpkg got interrupted is to run + 'dpkg --configure -a' as root. + """ + dpkg_status_dir = os.path.dirname(apt_pkg.Config.find_file("Dir::State::status")) + for f in os.listdir(os.path.join(dpkg_status_dir, "updates")): + if fnmatch.fnmatch(f, "[0-9]*"): + return True + return False + @property def broken_count(self): """Return the number of packages with broken dependencies.""" diff --git a/debian/changelog b/debian/changelog index b7bb3ad0..b1c7c1b5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,10 @@ python-apt (0.7.96) UNRELEASED; urgency=low - do not fail on non-digits in the version number * utils/get_debian_mirrors.py: - ignore mirrors without a county + * apt/cache.py: + - add new "dpkg_journal_dirty" property that can be used to + detect a interrupted dpkg (the famous + "E: dpkg was interrupted, you must manually run 'dpkg --configure -a'") [ Martin Pitt ] * tests/test_apt_cache.py: Test accessing the record of all packages during diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index a00fa08b..b27ed778 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -9,6 +9,9 @@ import unittest import apt +import apt_pkg +import os +import tempfile class TestAptCache(unittest.TestCase): @@ -39,5 +42,28 @@ class TestAptCache(unittest.TestCase): self.assert_(len(r['Description']) > 0) self.assert_(str(r).startswith('Package: %s\n' % pkg.name)) + 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") + os.makedirs(os.path.join(dpkg_dir,"updates")) + open(os.path.join(dpkg_dir,"status"), "w") + apt_pkg.Config.set("Dir::State::status", + os.path.join(dpkg_dir,"status")) + cache = apt.Cache() + # test empty + self.assertFalse(cache.dpkg_journal_dirty) + # that is ok, only [0-9] are dpkg jounral entries + open(os.path.join(dpkg_dir,"updates","xxx"), "w") + self.assertFalse(cache.dpkg_journal_dirty) + # that is a dirty journal + open(os.path.join(dpkg_dir,"updates","000"), "w") + self.assertTrue(cache.dpkg_journal_dirty) + # reset config value + apt_pkg.Config.set("Dir::State::status", old_status) + + if __name__ == "__main__": unittest.main() -- cgit v1.2.3 From a90b26aad2824d4bd224586cdf14c0ad21059ac3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 2 Jul 2010 10:59:08 +0200 Subject: add test_progress.py test --- tests/data/fake-packages/Packages | 21 +++++++++++++++++ tests/data/fake-packages/Packages.gz | Bin 0 -> 555 bytes tests/test_progress.py | 44 +++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 tests/data/fake-packages/Packages create mode 100644 tests/data/fake-packages/Packages.gz create mode 100644 tests/test_progress.py (limited to 'tests') diff --git a/tests/data/fake-packages/Packages b/tests/data/fake-packages/Packages new file mode 100644 index 00000000..9fbab957 --- /dev/null +++ b/tests/data/fake-packages/Packages @@ -0,0 +1,21 @@ +Package: 2vcard +Priority: optional +Section: universe/utils +Installed-Size: 108 +Maintainer: Arvind Autar +Architecture: amd64 +Version: 0.5-1ubuntu1 +Filename: pool/universe/2/2vcard/2vcard_0.5-1ubuntu1_amd64.deb +Size: 14164 +MD5sum: 105ea91f0a75417d0f9e8e9624513b2a +SHA1: d55beee01c08efc33cd131e106330dca72ee14be +SHA256: 4a72edaf87cdb826e5508b85311fcf0bec9b7e019a55740ded7feb1b9e197f11 +Description: A little perl script to convert an adressbook to VCARD file format + 2vcard is a little perl script that you can use to convert the popular vcard + file format. Currently 2vcard can only convert adressbooks and alias files from + the following formats: abook,eudora,juno,ldif,mutt,mh and pine. + . + The VCARD format is used by gnomecard, for example, which is turn is used by + the balsa email client. +Bugs: mailto:ubuntu-users@lists.ubuntu.com +Origin: Ubuntu diff --git a/tests/data/fake-packages/Packages.gz b/tests/data/fake-packages/Packages.gz new file mode 100644 index 00000000..506bc8d4 Binary files /dev/null and b/tests/data/fake-packages/Packages.gz differ diff --git a/tests/test_progress.py b/tests/test_progress.py new file mode 100644 index 00000000..2ab8ce5e --- /dev/null +++ b/tests/test_progress.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# +# Copyright (C) 2010 Michael Vogt +# +# 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 apt.progress""" +import unittest + +import apt +import apt_pkg +import os + +class TestAcquireProgress(apt.progress.base.AcquireProgress): + def pulse(self, owner): + self.pulsed = True + +class TestProgress(unittest.TestCase): + + def setUp(self): + basedir = os.path.abspath(os.path.dirname(__file__)) + # setup apt_pkg config + apt_pkg.init() + apt_pkg.config.set("APT::Architecture", "amd64") + apt_pkg.config.set("Dir::Etc", basedir) + apt_pkg.config.set("Dir::Etc::sourceparts", "/xxx") + # setup lists dir + if not os.path.exists("./tmp/partial"): + os.makedirs("./tmp/partial") + apt_pkg.config.set("Dir::state::lists", "./tmp") + # create artifical line + deb_line = "deb file:%s/data/fake-packages/ /\n" % basedir + open("fetch_sources.list","w").write(deb_line) + apt_pkg.config.set("Dir::Etc::sourcelist", "fetch_sources.list") + + def test_acquire_progress(self): + progress = TestAcquireProgress() + cache = apt.Cache() + res = cache.update(progress) + self.assertTrue(progress.pulsed) + +if __name__ == "__main__": + unittest.main() -- cgit v1.2.3 From dd86db9ddb22b43867b5b4dc211f4440dec7aa6a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 2 Jul 2010 16:37:45 +0200 Subject: * tests/test_debs/*.deb, tests/test_debfile.py: - add automatic test based on the test debs from gdebi --- apt/debfile.py | 10 ++++--- debian/changelog | 2 ++ tests/test_debfile.py | 56 +++++++++++++++++++++++++++++++++++++++ tests/test_debs/gdebi-test1.deb | Bin 0 -> 934 bytes tests/test_debs/gdebi-test10.deb | Bin 0 -> 614 bytes tests/test_debs/gdebi-test2.deb | Bin 0 -> 554 bytes tests/test_debs/gdebi-test3.deb | Bin 0 -> 570 bytes tests/test_debs/gdebi-test4.deb | Bin 0 -> 2306 bytes tests/test_debs/gdebi-test5.deb | Bin 0 -> 2306 bytes tests/test_debs/gdebi-test6.deb | Bin 0 -> 4312 bytes tests/test_debs/gdebi-test7.deb | Bin 0 -> 578 bytes tests/test_debs/gdebi-test8.deb | Bin 0 -> 598 bytes tests/test_debs/gdebi-test9.deb | Bin 0 -> 586 bytes 13 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 tests/test_debfile.py create mode 100644 tests/test_debs/gdebi-test1.deb create mode 100644 tests/test_debs/gdebi-test10.deb create mode 100644 tests/test_debs/gdebi-test2.deb create mode 100644 tests/test_debs/gdebi-test3.deb create mode 100644 tests/test_debs/gdebi-test4.deb create mode 100644 tests/test_debs/gdebi-test5.deb create mode 100644 tests/test_debs/gdebi-test6.deb create mode 100644 tests/test_debs/gdebi-test7.deb create mode 100644 tests/test_debs/gdebi-test8.deb create mode 100644 tests/test_debs/gdebi-test9.deb (limited to 'tests') diff --git a/apt/debfile.py b/apt/debfile.py index 173521b1..81cd1dd2 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -17,6 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA """Classes for working with locally available Debian packages.""" +import apt import apt_inst import apt_pkg import gzip @@ -44,19 +45,20 @@ class DebPackage(object): debug = 0 def __init__(self, filename=None, cache=None): + if cache is None: + cache = apt.Cache() self._cache = cache - self._need_pkgs = [] self._debfile = None self.pkgname = "" - self.filename = filename self._sections = {} - self._installed_conflicts = set() - self._failure_string = "" if filename: self.open(filename) def open(self, filename): """ open given debfile """ + self._need_pkgs = [] + self._installed_conflicts = set() + self._failure_string = "" self.filename = filename self._debfile = apt_inst.DebFile(open(self.filename)) control = self._debfile.control.extractdata("control") diff --git a/debian/changelog b/debian/changelog index 29f37932..b8ae49c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,8 @@ python-apt (0.7.96) UNRELEASED; urgency=low * apt/debfile.py: - check if the debfiles provides are in conflict with the systems packages + * tests/test_debs/*.deb, tests/test_debfile.py: + - add automatic test based on the test debs from gdebi [ Martin Pitt ] * tests/test_apt_cache.py: Test accessing the record of all packages during diff --git a/tests/test_debfile.py b/tests/test_debfile.py new file mode 100644 index 00000000..02e25117 --- /dev/null +++ b/tests/test_debfile.py @@ -0,0 +1,56 @@ +#!/usr/bin/python +# +# Copyright (C) 2010 Michael Vogt +# +# 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 DebPackage in apt.debfile.""" +import os +import logging +import unittest + +import sys +sys.path.insert(0, "..") + +import apt.debfile + + +class TestDebfilee(unittest.TestCase): + """ test the apt cache """ + + TEST_DEBS = [ + # conflicts with apt + ('gdebi-test1.deb', False), + # impossible dependency + ('gdebi-test2.deb', False), + # or-group (impossible-dependency|apt) + ('gdebi-test3.deb', True), + # Conflicts: apt (<= 0.1) + ('gdebi-test4.deb', True), + # Conflicts: apt (>= 0.1) + ('gdebi-test5.deb', False), + # invalid unicode in descr + ('gdebi-test6.deb', True), + # provides/conflicts against "foobarbaz" + ('gdebi-test7.deb', True), + # provides/conflicts/replaces against "mail-transport-agent" + # (should fails if mail-transport-agent is installed) + ('gdebi-test8.deb', False), + # provides/conflicts against real pkg + ('gdebi-test9.deb', True), + # provides debconf-tiny and the real debconf conflicts with + ('gdebi-test10.deb', False), + ] + + def testDebFile(self): + deb = apt.debfile.DebPackage() + for (filename, expected_res) in self.TEST_DEBS: + logging.debug("testing %s, expecting %s" % (filename, expected_res)) + deb.open(os.path.join("test_debs", filename)) + res = deb.check() + self.assertEqual(res, expected_res) + +if __name__ == "__main__": + #logging.basicConfig(level=logging.DEBUG) + unittest.main() diff --git a/tests/test_debs/gdebi-test1.deb b/tests/test_debs/gdebi-test1.deb new file mode 100644 index 00000000..ea9991ac Binary files /dev/null and b/tests/test_debs/gdebi-test1.deb differ diff --git a/tests/test_debs/gdebi-test10.deb b/tests/test_debs/gdebi-test10.deb new file mode 100644 index 00000000..ca43ace6 Binary files /dev/null and b/tests/test_debs/gdebi-test10.deb differ diff --git a/tests/test_debs/gdebi-test2.deb b/tests/test_debs/gdebi-test2.deb new file mode 100644 index 00000000..307ac689 Binary files /dev/null and b/tests/test_debs/gdebi-test2.deb differ diff --git a/tests/test_debs/gdebi-test3.deb b/tests/test_debs/gdebi-test3.deb new file mode 100644 index 00000000..436b9258 Binary files /dev/null and b/tests/test_debs/gdebi-test3.deb differ diff --git a/tests/test_debs/gdebi-test4.deb b/tests/test_debs/gdebi-test4.deb new file mode 100644 index 00000000..9eb92d1b Binary files /dev/null and b/tests/test_debs/gdebi-test4.deb differ diff --git a/tests/test_debs/gdebi-test5.deb b/tests/test_debs/gdebi-test5.deb new file mode 100644 index 00000000..0c98c03f Binary files /dev/null and b/tests/test_debs/gdebi-test5.deb differ diff --git a/tests/test_debs/gdebi-test6.deb b/tests/test_debs/gdebi-test6.deb new file mode 100644 index 00000000..32fd1800 Binary files /dev/null and b/tests/test_debs/gdebi-test6.deb differ diff --git a/tests/test_debs/gdebi-test7.deb b/tests/test_debs/gdebi-test7.deb new file mode 100644 index 00000000..c0414990 Binary files /dev/null and b/tests/test_debs/gdebi-test7.deb differ diff --git a/tests/test_debs/gdebi-test8.deb b/tests/test_debs/gdebi-test8.deb new file mode 100644 index 00000000..439f8ca7 Binary files /dev/null and b/tests/test_debs/gdebi-test8.deb differ diff --git a/tests/test_debs/gdebi-test9.deb b/tests/test_debs/gdebi-test9.deb new file mode 100644 index 00000000..9901d906 Binary files /dev/null and b/tests/test_debs/gdebi-test9.deb differ -- cgit v1.2.3 From b94455e7afd0e08ce1a8aab890dbee0d42566d7b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 6 Jul 2010 09:45:16 +0200 Subject: fix debfile to work with py3, update tests --- apt/debfile.py | 3 ++- tests/test_all.py | 32 ++++++++++++++++++++------------ tests/test_debfile.py | 3 ++- tests/test_debs/gdebi-test6.deb | Bin 4312 -> 600 bytes 4 files changed, 24 insertions(+), 14 deletions(-) (limited to 'tests') diff --git a/apt/debfile.py b/apt/debfile.py index 81cd1dd2..16d1b15e 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -62,7 +62,8 @@ class DebPackage(object): self.filename = filename self._debfile = apt_inst.DebFile(open(self.filename)) control = self._debfile.control.extractdata("control") - self._sections = apt_pkg.TagSection(control) + # hm, 'replace' is probably better but python2.6 test fail with that + self._sections = apt_pkg.TagSection(control.decode("UTF-8", 'ignore')) self.pkgname = self._sections["Package"] def __getitem__(self, key): diff --git a/tests/test_all.py b/tests/test_all.py index d561a9ae..d6370747 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -9,21 +9,29 @@ import os import unittest import sys -if __name__ == '__main__': - sys.stderr.write("[tests] Running on %s\n" % sys.version.replace("\n", "")) - os.chdir(os.path.dirname(__file__)) +def get_library_dir(): # Find the path to the built apt_pkg and apt_inst extensions - if os.path.exists("../build"): - from distutils.util import get_platform - from distutils.sysconfig import get_python_version - # Set the path to the build directory. - plat_specifier = ".%s-%s" % (get_platform(), get_python_version()) - if sys.version_info[0] >= 3 or sys.version_info[1] >= 6: - library_dir = "../build/lib%s%s" % (plat_specifier, + if not os.path.exists("../build"): + return None + from distutils.util import get_platform + from distutils.sysconfig import get_python_version + # Set the path to the build directory. + plat_specifier = ".%s-%s" % (get_platform(), get_python_version()) + if sys.version_info[0] >= 3 or sys.version_info[1] >= 6: + library_dir = "../build/lib%s%s" % (plat_specifier, (sys.pydebug and "-pydebug" or "")) - else: - library_dir = "../build/lib%s%s" % ((sys.pydebug and "_d" or ""), + else: + library_dir = "../build/lib%s%s" % ((sys.pydebug and "_d" or ""), plat_specifier) + return os.path.abspath(library_dir) + +if __name__ == '__main__': + sys.stderr.write("[tests] Running on %s\n" % sys.version.replace("\n", "")) + dirname = os.path.dirname(__file__) + if dirname: + os.chdir(dirname) + library_dir = get_library_dir() + if library_dir: sys.path.insert(0, os.path.abspath(library_dir)) for path in os.listdir('.'): diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 02e25117..56bbba9f 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -10,8 +10,9 @@ import os import logging import unittest +from test_all import get_library_dir import sys -sys.path.insert(0, "..") +sys.path.insert(0, get_library_dir()) import apt.debfile diff --git a/tests/test_debs/gdebi-test6.deb b/tests/test_debs/gdebi-test6.deb index 32fd1800..8ceacadc 100644 Binary files a/tests/test_debs/gdebi-test6.deb and b/tests/test_debs/gdebi-test6.deb differ -- cgit v1.2.3 From e94861e437dc544da9bf4a0161a25dedafd93f34 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 6 Jul 2010 10:35:57 +0200 Subject: * python/progress.cc: - deal with missing return value from the acquire progress in pulse() --- debian/changelog | 2 ++ python/progress.cc | 5 ++++- tests/test_progress.py | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/debian/changelog b/debian/changelog index 98be965a..b592eb84 100644 --- a/debian/changelog +++ b/debian/changelog @@ -24,6 +24,8 @@ python-apt (0.7.96) UNRELEASED; urgency=low - fix py3 compatibility * tests/test_debs/*.deb, tests/test_debfile.py: - add automatic test based on the test debs from gdebi + * python/progress.cc: + - deal with missing return value from the acquire progress in pulse() [ Martin Pitt ] * tests/test_apt_cache.py: Test accessing the record of all packages during diff --git a/python/progress.cc b/python/progress.cc index 9002b3eb..437309cf 100644 --- a/python/progress.cc +++ b/python/progress.cc @@ -300,7 +300,10 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner) Py_INCREF(pyAcquire); if (RunSimpleCallback("pulse", TUPLEIZE(pyAcquire) , &result1)) { - if (result1 != NULL && PyArg_Parse(result1, "b", &res1) && res1 == false) { + if (result1 != NULL && + result1 != Py_None && + PyArg_Parse(result1, "b", &res1) && + res1 == false) { // the user returned a explicit false here, stop PyCbObj_BEGIN_ALLOW_THREADS return false; diff --git a/tests/test_progress.py b/tests/test_progress.py index 2ab8ce5e..ffab5bc0 100644 --- a/tests/test_progress.py +++ b/tests/test_progress.py @@ -15,6 +15,9 @@ import os class TestAcquireProgress(apt.progress.base.AcquireProgress): def pulse(self, owner): self.pulsed = True + # there should be a return value here, either (True,False) + # but often this is forgoten (and causes odd error messages) + # so the lib supports it. we test the lack of support value here class TestProgress(unittest.TestCase): -- cgit v1.2.3 From 443fb34e5fa04392c82c0cf56d3ea3e086c704f8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 6 Jul 2010 10:42:26 +0200 Subject: tests/test_apt_cache.py: fixes for 0.8 compatibility --- tests/test_apt_cache.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test_apt_cache.py b/tests/test_apt_cache.py index 653a0f48..a43e92d2 100644 --- a/tests/test_apt_cache.py +++ b/tests/test_apt_cache.py @@ -62,13 +62,13 @@ class TestAptCache(unittest.TestCase): def test_dpkg_journal_dirty(self): # backup old value - old_status = apt_pkg.Config.find_file("Dir::State::status") + 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") os.makedirs(os.path.join(dpkg_dir,"updates")) open(os.path.join(dpkg_dir,"status"), "w") - apt_pkg.Config.set("Dir::State::status", + apt_pkg.config.set("Dir::State::status", os.path.join(dpkg_dir,"status")) cache = apt.Cache() # test empty @@ -80,7 +80,7 @@ class TestAptCache(unittest.TestCase): open(os.path.join(dpkg_dir,"updates","000"), "w") self.assertTrue(cache.dpkg_journal_dirty) # reset config value - apt_pkg.Config.set("Dir::State::status", old_status) + apt_pkg.config.set("Dir::State::status", old_status) if __name__ == "__main__": -- cgit v1.2.3 From e965c1321637d50986c243468d8095077f3e80ca Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 9 Jul 2010 22:51:51 +0200 Subject: tests/test_aptsources.py: fix test by forcing id=Ubuntu --- tests/test_aptsources.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index 767f5244..3ef20f64 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -98,7 +98,7 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" "sources.list.testDistribution") sources = aptsources.sourceslist.SourcesList(True, self.templates) - distro = aptsources.distro.get_distro() + distro = aptsources.distro.get_distro(id="Ubuntu") distro.get_sources(sources) # test if all suits of the current distro were detected correctly dist_templates = set() @@ -111,7 +111,7 @@ class TestAptSources(unittest.TestCase): apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/" "sources.list.testDistribution") sources = aptsources.sourceslist.SourcesList(True, self.templates) - distro = aptsources.distro.get_distro() + distro = aptsources.distro.get_distro(id="Ubuntu") distro.get_sources(sources) # test if all suits of the current distro were detected correctly dist_templates = set() -- cgit v1.2.3 From f75c59b6b250d14b1e52e1eebebfb5b11482d2ef Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 12 Jul 2010 14:10:40 +0200 Subject: tests/test_debfile.py: add fixture dpkg-status file to make tests work --- apt/debfile.py | 2 +- po/python-apt.pot | 58 ++++++++++++++++++++++++--------------------------- tests/test_debfile.py | 15 +++++++++---- 3 files changed, 39 insertions(+), 36 deletions(-) (limited to 'tests') diff --git a/apt/debfile.py b/apt/debfile.py index 16d1b15e..7a1fa82d 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -302,7 +302,7 @@ class DebPackage(object): """ # show progress information as this step may take some time size = float(len(self._cache)) - steps = int(size/50) + steps = max(int(size/50), 1) debver = self._sections["Version"] # store what we provide so that we can later check against that provides = [ x[0][0] for x in self.provides] diff --git a/po/python-apt.pot b/po/python-apt.pot index 9c10c43f..036495e2 100644 --- a/po/python-apt.pot +++ b/po/python-apt.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-07-02 14:12+0200\n" +"POT-Creation-Date: 2010-07-12 14:07+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -413,18 +413,23 @@ msgid "" "Please check your Internet connection." msgstr "" -#: ../apt/debfile.py:142 +#: ../apt/debfile.py:79 +#, python-format +msgid "List of files for '%s' could not be read" +msgstr "" + +#: ../apt/debfile.py:164 #, python-format msgid "Dependency is not satisfiable: %s\n" msgstr "" -#: ../apt/debfile.py:163 +#: ../apt/debfile.py:185 #, python-format msgid "Conflicts with the installed package '%s'" msgstr "" #. TRANSLATORS: the first '%s' is the package that breaks, the second the dependency that makes it break, the third the relation (e.g. >=) and the latest the version for the releation -#: ../apt/debfile.py:297 +#: ../apt/debfile.py:323 #, python-format msgid "" "Breaks existing package '%(pkgname)s' dependency %(depname)s (%(deprelation)" @@ -432,72 +437,63 @@ msgid "" msgstr "" #. TRANSLATORS: the first '%s' is the package that conflicts, the second the packagename that it conflicts with (so the name of the deb the user tries to install), the third is the relation (e.g. >=) and the last is the version for the relation -#: ../apt/debfile.py:313 +#: ../apt/debfile.py:339 #, python-format msgid "" "Breaks existing package '%(pkgname)s' conflict: %(targetpkg)s (%(comptype)s %" "(targetver)s)" msgstr "" -#: ../apt/debfile.py:359 +#: ../apt/debfile.py:348 +#, python-format +msgid "" +"Breaks existing package '%(pkgname)s' that conflict: '%(targetpkg)s'. But " +"the '%(debfile)s' provides it via: '%(provides)s'" +msgstr "" + +#: ../apt/debfile.py:394 msgid "No Architecture field in the package" msgstr "" -#: ../apt/debfile.py:364 +#: ../apt/debfile.py:399 #, python-format msgid "Wrong architecture '%s'" msgstr "" #. the deb is older than the installed -#: ../apt/debfile.py:371 +#: ../apt/debfile.py:406 msgid "A later version is already installed" msgstr "" -#: ../apt/debfile.py:396 +#: ../apt/debfile.py:431 msgid "Failed to satisfy all dependencies (broken cache)" msgstr "" -#: ../apt/debfile.py:425 +#: ../apt/debfile.py:461 #, python-format msgid "Cannot install '%s'" msgstr "" -#: ../apt/debfile.py:467 ../apt/debfile.py:513 ../apt/debfile.py:524 +#: ../apt/debfile.py:503 ../apt/debfile.py:549 ../apt/debfile.py:560 msgid "Python-debian module not available" msgstr "" -#: ../apt/debfile.py:497 +#: ../apt/debfile.py:533 msgid "" "Automatically decompressed:\n" "\n" msgstr "" -#: ../apt/debfile.py:503 +#: ../apt/debfile.py:539 msgid "Automatically converted to printable ascii:\n" msgstr "" -#: ../apt/debfile.py:549 -msgid "List of files could not be read, please report this as a bug" -msgstr "" - -#: ../apt/debfile.py:552 -#, python-format -msgid "IOError during filelist read: %s" -msgstr "" - -#. Translators: it's for missing entries in the deb package, -#. e.g. a missing "Maintainer" field -#: ../apt/debfile.py:559 -#, python-format -msgid "%s is not available" -msgstr "" - -#: ../apt/debfile.py:632 +#: ../apt/debfile.py:636 #, python-format msgid "Install Build-Dependencies for source package '%s' that builds %s\n" msgstr "" -#: ../apt/debfile.py:642 +#: ../apt/debfile.py:646 msgid "An essential package would be removed" msgstr "" diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 56bbba9f..6af0cf1c 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -13,10 +13,9 @@ import unittest from test_all import get_library_dir import sys sys.path.insert(0, get_library_dir()) - +import apt_pkg import apt.debfile - class TestDebfilee(unittest.TestCase): """ test the apt cache """ @@ -44,13 +43,21 @@ class TestDebfilee(unittest.TestCase): ('gdebi-test10.deb', False), ] + def setUp(self): + apt_pkg.config.set("APT::Architecture","i386") + apt_pkg.config.set("Dir::State::status", + "./test_debs/var/lib/dpkg/status") + self.cache = apt.Cache() + def testDebFile(self): - deb = apt.debfile.DebPackage() + deb = apt.debfile.DebPackage(cache=self.cache) for (filename, expected_res) in self.TEST_DEBS: logging.debug("testing %s, expecting %s" % (filename, expected_res)) deb.open(os.path.join("test_debs", filename)) res = deb.check() - self.assertEqual(res, expected_res) + self.assertEqual(res, expected_res, + "Unexpected result for package '%s' (got %s wanted %s)" % ( + filename, res, expected_res)) if __name__ == "__main__": #logging.basicConfig(level=logging.DEBUG) -- cgit v1.2.3 From 4325749c7bfe5f1e83983415e13eafd84bb62907 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 12 Jul 2010 14:37:58 +0200 Subject: tests/test_debs/var/lib/dpkg/status: adding fake status file --- tests/test_debs/var/lib/dpkg/status | 77 +++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tests/test_debs/var/lib/dpkg/status (limited to 'tests') diff --git a/tests/test_debs/var/lib/dpkg/status b/tests/test_debs/var/lib/dpkg/status new file mode 100644 index 00000000..443262e1 --- /dev/null +++ b/tests/test_debs/var/lib/dpkg/status @@ -0,0 +1,77 @@ +Package: apt +Status: hold ok installed +Priority: important +Section: admin +Installed-Size: 5456 +Maintainer: APT Development Team +Architecture: i386 +Version: 0.7.25.3 +Replaces: libapt-pkg-dev (<< 0.3.7), libapt-pkg-doc (<< 0.3.7) +Provides: libapt-pkg-libc6.10-6-4.8 +Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt +Conffiles: + /etc/cron.daily/apt 3528ddf873535d4c268d83e73e85dc79 + /etc/apt/apt.conf.d/01autoremove 6154750d39a78704b5bbf6fafd65ada7 + /etc/logrotate.d/apt 179f2ed4f85cbaca12fa3d69c2a4a1c3 + /etc/apt/apt.conf.d/01ubuntu 078b96538a377743bee0f554eb5b2fc6 obsolete +Description: Advanced front-end for dpkg + This is Debian's next generation front-end for the dpkg package manager. + It provides the apt-get utility and APT dselect method that provides a + simpler, safer way to install and upgrade packages. + . + APT features complete installation ordering, multiple source capability + and several other unique features, see the Users Guide in apt-doc. + +Package: postfix +Status: install ok installed +Priority: extra +Section: mail +Installed-Size: 3488 +Maintainer: LaMont Jones +Architecture: i386 +Version: 2.7.0-1 +Replaces: mail-transport-agent, postfix-tls +Provides: default-mta, mail-transport-agent, postfix-tls +Recommends: python +Suggests: procmail, postfix-mysql, postfix-pgsql, postfix-ldap, postfix-pcre, sasl2-bin, libsasl2-modules, resolvconf, postfix-cdb, mail-reader, ufw +Conflicts: libnss-db (<< 2.2-3), mail-transport-agent, postfix-tls, smail +Conffiles: + /etc/init.d/postfix e47d7ef0cbd2e212324812d74c409d77 + /etc/ppp/ip-up.d/postfix fccc53fc4eeeab46941ebcc95a71e766 + /etc/ppp/ip-down.d/postfix 52275dc23864f3bfca412c7558e28fe6 + /etc/network/if-up.d/postfix fccc53fc4eeeab46941ebcc95a71e766 + /etc/network/if-down.d/postfix 52275dc23864f3bfca412c7558e28fe6 + /etc/postfix/postfix-script 0d01860b2f0778cf41951c801f538b30 + /etc/postfix/post-install d53706c232f6497539fa0c99df674b33 + /etc/postfix/postfix-files 47e63262ab84069c840556b469b0fb2f + /etc/rsyslog.d/postfix.conf d8a09827fff2a22311e4dd4a83e95c83 + /etc/ufw/applications.d/postfix 6716a7729145a40bf7cb721c8dc6c3b0 + /etc/resolvconf/update-libc.d/postfix 6c80adbe120bc46cbf42658a7364e17f +Description: High-performance mail transport agent + Postfix is Wietse Venema's mail transport agent that started life as an + alternative to the widely-used Sendmail program. Postfix attempts to + be fast, easy to administer, and secure, while at the same time being + sendmail compatible enough to not upset existing users. Thus, the outside + has a sendmail-ish flavor, but the inside is completely different. + +Package: debconf +Status: install ok installed +Priority: important +Section: admin +Installed-Size: 924 +Maintainer: Debconf Developers +Architecture: all +Version: 1.5.28 +Replaces: debconf-tiny +Provides: debconf-2.0 +Recommends: apt-utils (>= 0.5.1) +Suggests: debconf-doc, debconf-utils, whiptail | dialog | gnome-utils, libterm-readline-gnu-perl, libgnome2-perl, libnet-ldap-perl, perl +Conflicts: apt (<< 0.3.12.1), cdebconf (<< 0.96), debconf-tiny, debconf-utils (<< 1.3.22), dialog (<< 0.9b-20020814-1), menu (<= 2.1.3-1), whiptail (<< 0.51.4-11), whiptail-utf8 (<= 0.50.17-13) +Conffiles: + /etc/apt/apt.conf.d/70debconf 7e9d09d5801a42b4926b736b8eeabb73 + /etc/bash_completion.d/debconf 8fa1862734fbe54d7178aaaa419f5a11 + /etc/debconf.conf 8c0619be413824f1fc7698cee0f23811 +Description: Debian configuration management system + Debconf is a configuration management system for debian packages. Packages + use Debconf to ask questions when they are installed. +Python-Version: 2.6, 3.1 -- cgit v1.2.3 From 3b155e595fed78f8eac22de78106cd3dcad9793c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 12 Jul 2010 14:42:39 +0200 Subject: tests/test_debfile.py: move test_debs into tests/data --- tests/data/test_debs/gdebi-test1.deb | Bin 0 -> 934 bytes tests/data/test_debs/gdebi-test10.deb | Bin 0 -> 614 bytes tests/data/test_debs/gdebi-test2.deb | Bin 0 -> 554 bytes tests/data/test_debs/gdebi-test3.deb | Bin 0 -> 570 bytes tests/data/test_debs/gdebi-test4.deb | Bin 0 -> 2306 bytes tests/data/test_debs/gdebi-test5.deb | Bin 0 -> 2306 bytes tests/data/test_debs/gdebi-test6.deb | Bin 0 -> 600 bytes tests/data/test_debs/gdebi-test7.deb | Bin 0 -> 578 bytes tests/data/test_debs/gdebi-test8.deb | Bin 0 -> 598 bytes tests/data/test_debs/gdebi-test9.deb | Bin 0 -> 586 bytes tests/data/test_debs/var/lib/dpkg/status | 77 +++++++++++++++++++++++++++++++ tests/test_debfile.py | 4 +- tests/test_debs/gdebi-test1.deb | Bin 934 -> 0 bytes tests/test_debs/gdebi-test10.deb | Bin 614 -> 0 bytes tests/test_debs/gdebi-test2.deb | Bin 554 -> 0 bytes tests/test_debs/gdebi-test3.deb | Bin 570 -> 0 bytes tests/test_debs/gdebi-test4.deb | Bin 2306 -> 0 bytes tests/test_debs/gdebi-test5.deb | Bin 2306 -> 0 bytes tests/test_debs/gdebi-test6.deb | Bin 600 -> 0 bytes tests/test_debs/gdebi-test7.deb | Bin 578 -> 0 bytes tests/test_debs/gdebi-test8.deb | Bin 598 -> 0 bytes tests/test_debs/gdebi-test9.deb | Bin 586 -> 0 bytes tests/test_debs/var/lib/dpkg/status | 77 ------------------------------- 23 files changed, 79 insertions(+), 79 deletions(-) create mode 100644 tests/data/test_debs/gdebi-test1.deb create mode 100644 tests/data/test_debs/gdebi-test10.deb create mode 100644 tests/data/test_debs/gdebi-test2.deb create mode 100644 tests/data/test_debs/gdebi-test3.deb create mode 100644 tests/data/test_debs/gdebi-test4.deb create mode 100644 tests/data/test_debs/gdebi-test5.deb create mode 100644 tests/data/test_debs/gdebi-test6.deb create mode 100644 tests/data/test_debs/gdebi-test7.deb create mode 100644 tests/data/test_debs/gdebi-test8.deb create mode 100644 tests/data/test_debs/gdebi-test9.deb create mode 100644 tests/data/test_debs/var/lib/dpkg/status delete mode 100644 tests/test_debs/gdebi-test1.deb delete mode 100644 tests/test_debs/gdebi-test10.deb delete mode 100644 tests/test_debs/gdebi-test2.deb delete mode 100644 tests/test_debs/gdebi-test3.deb delete mode 100644 tests/test_debs/gdebi-test4.deb delete mode 100644 tests/test_debs/gdebi-test5.deb delete mode 100644 tests/test_debs/gdebi-test6.deb delete mode 100644 tests/test_debs/gdebi-test7.deb delete mode 100644 tests/test_debs/gdebi-test8.deb delete mode 100644 tests/test_debs/gdebi-test9.deb delete mode 100644 tests/test_debs/var/lib/dpkg/status (limited to 'tests') diff --git a/tests/data/test_debs/gdebi-test1.deb b/tests/data/test_debs/gdebi-test1.deb new file mode 100644 index 00000000..ea9991ac Binary files /dev/null and b/tests/data/test_debs/gdebi-test1.deb differ diff --git a/tests/data/test_debs/gdebi-test10.deb b/tests/data/test_debs/gdebi-test10.deb new file mode 100644 index 00000000..ca43ace6 Binary files /dev/null and b/tests/data/test_debs/gdebi-test10.deb differ diff --git a/tests/data/test_debs/gdebi-test2.deb b/tests/data/test_debs/gdebi-test2.deb new file mode 100644 index 00000000..307ac689 Binary files /dev/null and b/tests/data/test_debs/gdebi-test2.deb differ diff --git a/tests/data/test_debs/gdebi-test3.deb b/tests/data/test_debs/gdebi-test3.deb new file mode 100644 index 00000000..436b9258 Binary files /dev/null and b/tests/data/test_debs/gdebi-test3.deb differ diff --git a/tests/data/test_debs/gdebi-test4.deb b/tests/data/test_debs/gdebi-test4.deb new file mode 100644 index 00000000..9eb92d1b Binary files /dev/null and b/tests/data/test_debs/gdebi-test4.deb differ diff --git a/tests/data/test_debs/gdebi-test5.deb b/tests/data/test_debs/gdebi-test5.deb new file mode 100644 index 00000000..0c98c03f Binary files /dev/null and b/tests/data/test_debs/gdebi-test5.deb differ diff --git a/tests/data/test_debs/gdebi-test6.deb b/tests/data/test_debs/gdebi-test6.deb new file mode 100644 index 00000000..8ceacadc Binary files /dev/null and b/tests/data/test_debs/gdebi-test6.deb differ diff --git a/tests/data/test_debs/gdebi-test7.deb b/tests/data/test_debs/gdebi-test7.deb new file mode 100644 index 00000000..c0414990 Binary files /dev/null and b/tests/data/test_debs/gdebi-test7.deb differ diff --git a/tests/data/test_debs/gdebi-test8.deb b/tests/data/test_debs/gdebi-test8.deb new file mode 100644 index 00000000..439f8ca7 Binary files /dev/null and b/tests/data/test_debs/gdebi-test8.deb differ diff --git a/tests/data/test_debs/gdebi-test9.deb b/tests/data/test_debs/gdebi-test9.deb new file mode 100644 index 00000000..9901d906 Binary files /dev/null and b/tests/data/test_debs/gdebi-test9.deb differ diff --git a/tests/data/test_debs/var/lib/dpkg/status b/tests/data/test_debs/var/lib/dpkg/status new file mode 100644 index 00000000..443262e1 --- /dev/null +++ b/tests/data/test_debs/var/lib/dpkg/status @@ -0,0 +1,77 @@ +Package: apt +Status: hold ok installed +Priority: important +Section: admin +Installed-Size: 5456 +Maintainer: APT Development Team +Architecture: i386 +Version: 0.7.25.3 +Replaces: libapt-pkg-dev (<< 0.3.7), libapt-pkg-doc (<< 0.3.7) +Provides: libapt-pkg-libc6.10-6-4.8 +Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt +Conffiles: + /etc/cron.daily/apt 3528ddf873535d4c268d83e73e85dc79 + /etc/apt/apt.conf.d/01autoremove 6154750d39a78704b5bbf6fafd65ada7 + /etc/logrotate.d/apt 179f2ed4f85cbaca12fa3d69c2a4a1c3 + /etc/apt/apt.conf.d/01ubuntu 078b96538a377743bee0f554eb5b2fc6 obsolete +Description: Advanced front-end for dpkg + This is Debian's next generation front-end for the dpkg package manager. + It provides the apt-get utility and APT dselect method that provides a + simpler, safer way to install and upgrade packages. + . + APT features complete installation ordering, multiple source capability + and several other unique features, see the Users Guide in apt-doc. + +Package: postfix +Status: install ok installed +Priority: extra +Section: mail +Installed-Size: 3488 +Maintainer: LaMont Jones +Architecture: i386 +Version: 2.7.0-1 +Replaces: mail-transport-agent, postfix-tls +Provides: default-mta, mail-transport-agent, postfix-tls +Recommends: python +Suggests: procmail, postfix-mysql, postfix-pgsql, postfix-ldap, postfix-pcre, sasl2-bin, libsasl2-modules, resolvconf, postfix-cdb, mail-reader, ufw +Conflicts: libnss-db (<< 2.2-3), mail-transport-agent, postfix-tls, smail +Conffiles: + /etc/init.d/postfix e47d7ef0cbd2e212324812d74c409d77 + /etc/ppp/ip-up.d/postfix fccc53fc4eeeab46941ebcc95a71e766 + /etc/ppp/ip-down.d/postfix 52275dc23864f3bfca412c7558e28fe6 + /etc/network/if-up.d/postfix fccc53fc4eeeab46941ebcc95a71e766 + /etc/network/if-down.d/postfix 52275dc23864f3bfca412c7558e28fe6 + /etc/postfix/postfix-script 0d01860b2f0778cf41951c801f538b30 + /etc/postfix/post-install d53706c232f6497539fa0c99df674b33 + /etc/postfix/postfix-files 47e63262ab84069c840556b469b0fb2f + /etc/rsyslog.d/postfix.conf d8a09827fff2a22311e4dd4a83e95c83 + /etc/ufw/applications.d/postfix 6716a7729145a40bf7cb721c8dc6c3b0 + /etc/resolvconf/update-libc.d/postfix 6c80adbe120bc46cbf42658a7364e17f +Description: High-performance mail transport agent + Postfix is Wietse Venema's mail transport agent that started life as an + alternative to the widely-used Sendmail program. Postfix attempts to + be fast, easy to administer, and secure, while at the same time being + sendmail compatible enough to not upset existing users. Thus, the outside + has a sendmail-ish flavor, but the inside is completely different. + +Package: debconf +Status: install ok installed +Priority: important +Section: admin +Installed-Size: 924 +Maintainer: Debconf Developers +Architecture: all +Version: 1.5.28 +Replaces: debconf-tiny +Provides: debconf-2.0 +Recommends: apt-utils (>= 0.5.1) +Suggests: debconf-doc, debconf-utils, whiptail | dialog | gnome-utils, libterm-readline-gnu-perl, libgnome2-perl, libnet-ldap-perl, perl +Conflicts: apt (<< 0.3.12.1), cdebconf (<< 0.96), debconf-tiny, debconf-utils (<< 1.3.22), dialog (<< 0.9b-20020814-1), menu (<= 2.1.3-1), whiptail (<< 0.51.4-11), whiptail-utf8 (<= 0.50.17-13) +Conffiles: + /etc/apt/apt.conf.d/70debconf 7e9d09d5801a42b4926b736b8eeabb73 + /etc/bash_completion.d/debconf 8fa1862734fbe54d7178aaaa419f5a11 + /etc/debconf.conf 8c0619be413824f1fc7698cee0f23811 +Description: Debian configuration management system + Debconf is a configuration management system for debian packages. Packages + use Debconf to ask questions when they are installed. +Python-Version: 2.6, 3.1 diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 6af0cf1c..c71c34a3 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -46,14 +46,14 @@ class TestDebfilee(unittest.TestCase): def setUp(self): apt_pkg.config.set("APT::Architecture","i386") apt_pkg.config.set("Dir::State::status", - "./test_debs/var/lib/dpkg/status") + "./data/test_debs/var/lib/dpkg/status") self.cache = apt.Cache() def testDebFile(self): deb = apt.debfile.DebPackage(cache=self.cache) for (filename, expected_res) in self.TEST_DEBS: logging.debug("testing %s, expecting %s" % (filename, expected_res)) - deb.open(os.path.join("test_debs", filename)) + deb.open(os.path.join("data", "test_debs", filename)) res = deb.check() self.assertEqual(res, expected_res, "Unexpected result for package '%s' (got %s wanted %s)" % ( diff --git a/tests/test_debs/gdebi-test1.deb b/tests/test_debs/gdebi-test1.deb deleted file mode 100644 index ea9991ac..00000000 Binary files a/tests/test_debs/gdebi-test1.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test10.deb b/tests/test_debs/gdebi-test10.deb deleted file mode 100644 index ca43ace6..00000000 Binary files a/tests/test_debs/gdebi-test10.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test2.deb b/tests/test_debs/gdebi-test2.deb deleted file mode 100644 index 307ac689..00000000 Binary files a/tests/test_debs/gdebi-test2.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test3.deb b/tests/test_debs/gdebi-test3.deb deleted file mode 100644 index 436b9258..00000000 Binary files a/tests/test_debs/gdebi-test3.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test4.deb b/tests/test_debs/gdebi-test4.deb deleted file mode 100644 index 9eb92d1b..00000000 Binary files a/tests/test_debs/gdebi-test4.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test5.deb b/tests/test_debs/gdebi-test5.deb deleted file mode 100644 index 0c98c03f..00000000 Binary files a/tests/test_debs/gdebi-test5.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test6.deb b/tests/test_debs/gdebi-test6.deb deleted file mode 100644 index 8ceacadc..00000000 Binary files a/tests/test_debs/gdebi-test6.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test7.deb b/tests/test_debs/gdebi-test7.deb deleted file mode 100644 index c0414990..00000000 Binary files a/tests/test_debs/gdebi-test7.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test8.deb b/tests/test_debs/gdebi-test8.deb deleted file mode 100644 index 439f8ca7..00000000 Binary files a/tests/test_debs/gdebi-test8.deb and /dev/null differ diff --git a/tests/test_debs/gdebi-test9.deb b/tests/test_debs/gdebi-test9.deb deleted file mode 100644 index 9901d906..00000000 Binary files a/tests/test_debs/gdebi-test9.deb and /dev/null differ diff --git a/tests/test_debs/var/lib/dpkg/status b/tests/test_debs/var/lib/dpkg/status deleted file mode 100644 index 443262e1..00000000 --- a/tests/test_debs/var/lib/dpkg/status +++ /dev/null @@ -1,77 +0,0 @@ -Package: apt -Status: hold ok installed -Priority: important -Section: admin -Installed-Size: 5456 -Maintainer: APT Development Team -Architecture: i386 -Version: 0.7.25.3 -Replaces: libapt-pkg-dev (<< 0.3.7), libapt-pkg-doc (<< 0.3.7) -Provides: libapt-pkg-libc6.10-6-4.8 -Suggests: aptitude | synaptic | wajig, dpkg-dev, apt-doc, bzip2, lzma, python-apt -Conffiles: - /etc/cron.daily/apt 3528ddf873535d4c268d83e73e85dc79 - /etc/apt/apt.conf.d/01autoremove 6154750d39a78704b5bbf6fafd65ada7 - /etc/logrotate.d/apt 179f2ed4f85cbaca12fa3d69c2a4a1c3 - /etc/apt/apt.conf.d/01ubuntu 078b96538a377743bee0f554eb5b2fc6 obsolete -Description: Advanced front-end for dpkg - This is Debian's next generation front-end for the dpkg package manager. - It provides the apt-get utility and APT dselect method that provides a - simpler, safer way to install and upgrade packages. - . - APT features complete installation ordering, multiple source capability - and several other unique features, see the Users Guide in apt-doc. - -Package: postfix -Status: install ok installed -Priority: extra -Section: mail -Installed-Size: 3488 -Maintainer: LaMont Jones -Architecture: i386 -Version: 2.7.0-1 -Replaces: mail-transport-agent, postfix-tls -Provides: default-mta, mail-transport-agent, postfix-tls -Recommends: python -Suggests: procmail, postfix-mysql, postfix-pgsql, postfix-ldap, postfix-pcre, sasl2-bin, libsasl2-modules, resolvconf, postfix-cdb, mail-reader, ufw -Conflicts: libnss-db (<< 2.2-3), mail-transport-agent, postfix-tls, smail -Conffiles: - /etc/init.d/postfix e47d7ef0cbd2e212324812d74c409d77 - /etc/ppp/ip-up.d/postfix fccc53fc4eeeab46941ebcc95a71e766 - /etc/ppp/ip-down.d/postfix 52275dc23864f3bfca412c7558e28fe6 - /etc/network/if-up.d/postfix fccc53fc4eeeab46941ebcc95a71e766 - /etc/network/if-down.d/postfix 52275dc23864f3bfca412c7558e28fe6 - /etc/postfix/postfix-script 0d01860b2f0778cf41951c801f538b30 - /etc/postfix/post-install d53706c232f6497539fa0c99df674b33 - /etc/postfix/postfix-files 47e63262ab84069c840556b469b0fb2f - /etc/rsyslog.d/postfix.conf d8a09827fff2a22311e4dd4a83e95c83 - /etc/ufw/applications.d/postfix 6716a7729145a40bf7cb721c8dc6c3b0 - /etc/resolvconf/update-libc.d/postfix 6c80adbe120bc46cbf42658a7364e17f -Description: High-performance mail transport agent - Postfix is Wietse Venema's mail transport agent that started life as an - alternative to the widely-used Sendmail program. Postfix attempts to - be fast, easy to administer, and secure, while at the same time being - sendmail compatible enough to not upset existing users. Thus, the outside - has a sendmail-ish flavor, but the inside is completely different. - -Package: debconf -Status: install ok installed -Priority: important -Section: admin -Installed-Size: 924 -Maintainer: Debconf Developers -Architecture: all -Version: 1.5.28 -Replaces: debconf-tiny -Provides: debconf-2.0 -Recommends: apt-utils (>= 0.5.1) -Suggests: debconf-doc, debconf-utils, whiptail | dialog | gnome-utils, libterm-readline-gnu-perl, libgnome2-perl, libnet-ldap-perl, perl -Conflicts: apt (<< 0.3.12.1), cdebconf (<< 0.96), debconf-tiny, debconf-utils (<< 1.3.22), dialog (<< 0.9b-20020814-1), menu (<= 2.1.3-1), whiptail (<< 0.51.4-11), whiptail-utf8 (<= 0.50.17-13) -Conffiles: - /etc/apt/apt.conf.d/70debconf 7e9d09d5801a42b4926b736b8eeabb73 - /etc/bash_completion.d/debconf 8fa1862734fbe54d7178aaaa419f5a11 - /etc/debconf.conf 8c0619be413824f1fc7698cee0f23811 -Description: Debian configuration management system - Debconf is a configuration management system for debian packages. Packages - use Debconf to ask questions when they are installed. -Python-Version: 2.6, 3.1 -- cgit v1.2.3 From 07e4a58a369de9ce7855db79d51490296d5cf6e5 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 12 Jul 2010 15:16:45 +0200 Subject: apply fix from juliank for the tests (many thanks!) --- tests/test_debfile.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/test_debfile.py b/tests/test_debfile.py index e4755b5b..bb9fd62c 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -44,9 +44,11 @@ class TestDebfilee(unittest.TestCase): ] def setUp(self): + apt_pkg.init_config() apt_pkg.config.set("APT::Architecture","i386") apt_pkg.config.set("Dir::State::status", "./data/test_debs/var/lib/dpkg/status") + apt_pkg.init_system() self.cache = apt.Cache() def testDebFile(self): -- cgit v1.2.3