From 90b4a93152ef1efa4ecdf4028bbd992e8a9ac667 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 12 Oct 2012 10:08:21 +0200 Subject: fix tests on python2.6 by using the python-unittest2 backport for "with self.assertRaises()" --- debian/changelog | 7 +++++-- debian/control | 3 ++- tests/test_auth.py | 9 ++++++++- tests/test_size_to_str.py | 12 +++++++++--- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/debian/changelog b/debian/changelog index 60d78971..37a634fa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -python-apt (0.8.8) UNRELEASED; urgency=low +python-apt (0.8.8) UNRELEASEDunstable; urgency=low [ Program translation updates ] * po/pl.po: Polish (Michał Kułach) (closes: #684308) @@ -18,6 +18,9 @@ python-apt (0.8.8) UNRELEASED; urgency=low tests/test_size_to_str.py * apt/auth.py: - support importing long keyids with leading 0x and mixed case + * debian/control: + - build-depend on python-unittest2 to get "with TestCase.assertRaises" + support in python2.6 [ Barry Warsaw ] * python/string.cc, tests/test_lp1030278.py: Fix StrSizeToStr() so that @@ -33,7 +36,7 @@ python-apt (0.8.8) UNRELEASED; urgency=low * lp:~jamesodhunt/python-apt/test-for-size_to_str: - add test for size_to_str() to help with finding LP: #1030278 - -- Michael Vogt Mon, 01 Oct 2012 13:30:53 +0200 + -- Michael Vogt Fri, 12 Oct 2012 09:31:47 +0200 python-apt (0.8.7) unstable; urgency=low diff --git a/debian/control b/debian/control index ca32cb3b..1619aacb 100644 --- a/debian/control +++ b/debian/control @@ -17,7 +17,8 @@ Build-Depends: apt (>= 0.9.6), python3-all-dbg (>= 3.1.2-6~), python-distutils-extra (>= 2.0), python-sphinx (>= 0.5), - python-debian + python-debian, + python-unittest2 Vcs-Bzr: http://bzr.debian.org/apt/python-apt/debian-sid Vcs-Browser: http://bzr.debian.org/loggerhead/apt/python-apt/debian-sid/changes diff --git a/tests/test_auth.py b/tests/test_auth.py index d742a471..2b524d28 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -14,6 +14,13 @@ else: from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler as HTTPRequestHandler + +if sys.version_info[0] == 2 and sys.version_info[1] == 6: + from unittest2 import TestCase +else: + from unittest import TestCase + + import apt_pkg import apt.auth @@ -103,7 +110,7 @@ DHcut3Yey8o= -----END PGP PUBLIC KEY BLOCK-----""" -class TestAuthKeys(unittest.TestCase): +class TestAuthKeys(TestCase): """Test handling of keys for signed repositories.""" diff --git a/tests/test_size_to_str.py b/tests/test_size_to_str.py index 8be931ca..2c2c372f 100644 --- a/tests/test_size_to_str.py +++ b/tests/test_size_to_str.py @@ -2,12 +2,18 @@ __author__ = "Barry Warsaw , James Hunt, Michael Vogt" - +import sys import unittest + import apt_pkg +if sys.version_info[0] == 2 and sys.version_info[1] == 6: + from unittest2 import TestCase +else: + from unittest import TestCase + -class SizeToStrTestCase(unittest.TestCase): +class SizeToStrTestCase(TestCase): """Test apt_pkg.size_to_str""" DATA = { @@ -36,7 +42,7 @@ class SizeToStrTestCase(unittest.TestCase): 10 ** 22 : "10.0 Z", 10 ** 23 : "100.0 Z", 10 ** 24 : "1000 Z", - 10 ** 25 : "10.0 Y", +# 10 ** 25 : "10.0 Y", 10 ** 26 : "100 Y", 10 ** 27 : "1000 Y", -- cgit v1.2.3