summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-07-12 14:10:40 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-07-12 14:10:40 +0200
commitf75c59b6b250d14b1e52e1eebebfb5b11482d2ef (patch)
tree07fb10c7a2e4df4e1f3c1ab3675c2a2f59c3b1c1
parentb94455e7afd0e08ce1a8aab890dbee0d42566d7b (diff)
downloadpython-apt-f75c59b6b250d14b1e52e1eebebfb5b11482d2ef.tar.gz
tests/test_debfile.py: add fixture dpkg-status file to make tests work
-rw-r--r--apt/debfile.py2
-rw-r--r--po/python-apt.pot58
-rw-r--r--tests/test_debfile.py15
3 files changed, 39 insertions, 36 deletions
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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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)