[python-debian/master] Fix FTBFS

John Wright jsw at debian.org
Mon Apr 18 00:27:58 UTC 2011


A test I added was unconditionally testing a class that relied on
apt_pkg being available.

Closes: #623011
---
 debian/changelog             |    7 +++++++
 tests/test_debian_support.py |   18 +++++++-----------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 253351b..5521023 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+python-debian (0.1.20) UNRELEASED; urgency=low
+
+  * Fix FTBFS, caused by referring to apt_pkg in a test with no
+    python-apt Build-Depends. (Closes: #623011)
+
+ -- John Wright <jsw at debian.org>  Sun, 17 Apr 2011 17:26:02 -0700
+
 python-debian (0.1.19) unstable; urgency=low
 
   * debian_support.BaseVersion: Disallow ':' in upstream version if
diff --git a/tests/test_debian_support.py b/tests/test_debian_support.py
index 2a8355a..205c037 100755
--- a/tests/test_debian_support.py
+++ b/tests/test_debian_support.py
@@ -30,13 +30,14 @@ from debian_support import *
 class VersionTests(unittest.TestCase):
     """Tests for AptPkgVersion and NativeVersion classes in debian_support"""
 
-    def _test_version(self, full_version, epoch, upstream, debian):
+    def setUp(self):
         if debian_support._have_apt_pkg:
-            test_classes = [AptPkgVersion, NativeVersion]
+            self.test_classes = [AptPkgVersion, NativeVersion]
         else:
-            test_classes = [NativeVersion]
+            self.test_classes = [NativeVersion]
 
-        for cls in test_classes:
+    def _test_version(self, full_version, epoch, upstream, debian):
+        for cls in self.test_classes:
             v = cls(full_version)
             self.assertEqual(v.full_version, full_version,
                              "%s: full_version broken" % cls)
@@ -72,17 +73,12 @@ class VersionTests(unittest.TestCase):
         self._test_version('2:1.0.4+svn26-1ubuntu1', '2', '1.0.4+svn26',
                            '1ubuntu1')
         self._test_version('2:1.0.4~rc2-1', '2', '1.0.4~rc2', '1')
-        for cls in AptPkgVersion, NativeVersion:
+        for cls in self.test_classes:
             self.assertRaises(
                 ValueError, cls, 'a1:1.8.8-070403-1~priv1')
 
     def test_version_updating(self):
-        if debian_support._have_apt_pkg:
-            test_classes = [AptPkgVersion, NativeVersion]
-        else:
-            test_classes = [NativeVersion]
-
-        for cls in test_classes:
+        for cls in self.test_classes:
             v = cls('1:1.4.1-1')
 
             v.debian_version = '2'
-- 
1.7.1




More information about the pkg-python-debian-commits mailing list