[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#755342: python-apt: fix FTBFS: tests failures



Source: src:python-apt
Version: 0.9.3.8
Tags: patch

Hi,

The error reported was introduced with gnupg 1.4.18, specifically by
upstream commit 'Screen keyserver responses'
(5230304349490f31aa64ee2b69a8a2bc06bf7816).

The attached patch fixes this bug (update for gnupg 1.4.18) and #759500
(update for pep8 1.5.7).

May you please consider it for an upload?

Thank you!


Explanation & Details:
----------------------

gnupg commit 'Screen keyserver responses' makes gpg to fail earlier than before
when fingerprint verification fails, thus raising a different exception in
'_add_key_from_keyserver' (apt/auth.py), so the test for which exception it
raises needs to be updated.


Test PASS (without commit 'Screen keyserver responses')

	$ python2.7 tests/test_all.py -q TestAuthKeys
	[tests] Running on 2.7.8 (default, Aug 26 2014, 22:15:24) [GCC 4.9.1]
Using library_dir: '/[...]/build/lib.linux-ppc64le-2.7'----------------------------------------------------------------------
	Ran 6 tests in 1.844s

	OK


Test FAIL (with commit 'Screen keyserver responses')
  (note the different string printed in AssertionError)

	$ python2.7 tests/test_all.py -q TestAuthKeys
	[tests] Running on 2.7.8 (default, Aug 26 2014, 22:15:24) [GCC 4.9.1]
Using library_dir: '/[...]/build/lib.linux-ppc64le-2.7'======================================================================
	FAIL: test_add_key_from_server_mitm (test_auth.TestAuthKeys)
	Verify that the key fingerprint is verified after download
	----------------------------------------------------------------------
	Traceback (most recent call last):
File "/[...]/tests/test_auth.py", line 216, in test_add_key_from_server_mitm
	    cm.exception)
AssertionError: recv from 'hkp://localhost:19192' failed for '0101010178F7FE5C3E65D8AF8B48AD6246925553'

	----------------------------------------------------------------------
	Ran 6 tests in 1.779s

	FAILED (failures=1)


With patch applied:

	$ python2.7 tests/test_all.py -q TestAuthKeys
	[tests] Running on 2.7.8 (default, Aug 26 2014, 22:15:24) [GCC 4.9.1]
Using library_dir: '/[...]/build/lib.linux-ppc64le-2.7'----------------------------------------------------------------------
	Ran 6 tests in 1.793s

	OK
	$ python3.4 tests/test_all.py -q TestAuthKeys
	[tests] Running on 3.4.1+ (default, Aug 21 2014, 11:23:41) [GCC 4.9.1]
Using library_dir: '/[...]/build/lib.linux-ppc64le-3.4'----------------------------------------------------------------------
	Ran 6 tests in 1.778s

	OK


Relevant piece from 'apt/auth.py':

   # download the key to a temp keyring first
    res = subprocess.call(gpg_default_options + [
        "--secret-keyring", tmp_secret_keyring,
        "--keyring", tmp_keyring,
        "--keyserver", keyserver,
        "--recv", keyid,
    ])
    if res != 0:
        raise AptKeyError("recv from '%s' failed for '%s'" % (
            keyserver, keyid))
    [...]
    [...]
    [...]
    if got_fingerprint != signing_key_fingerprint:
        raise AptKeyError(
            "Fingerprints do not match, not importing: '%s' != '%s'" % (


Excerpt from build log (attached):

	set -e; for python in python2.7 python3.4 ; do \
		$python tests/test_all.py -q || [ "linux" = "hurd" ]; \
	done;
	[tests] Running on 2.7.8 (default, Aug 26 2014, 22:15:24) [GCC 4.9.1]
Using library_dir: '/[...]/build/lib.linux-ppc64le-2.7'WARNING: Failed to read mirror file
	WARNING: Failed to read mirror file
	WARNING: Failed to read mirror file
	WARNING: Failed to read mirror file
	WARNING: Failed to read mirror file
	WARNING: Failed to read mirror file
	WARNING: Failed to read mirror file
	WARNING: Failed to read mirror file
	----------------------------------------------------------------------
	Ran 88 tests in 14.182s

	OK



--
Mauricio Faria de Oliveira
IBM Linux Technology Center
diff -Nru python-apt-0.9.3.8/debian/changelog python-apt-0.9.3.8ppc64el2/debian/changelog
--- python-apt-0.9.3.8/debian/changelog	2014-06-30 08:32:24.000000000 -0300
+++ python-apt-0.9.3.8ppc64el2/debian/changelog	2014-08-27 21:30:44.000000000 -0300
@@ -1,3 +1,14 @@
+python-apt (0.9.3.8ppc64el2) UNRELEASED; urgency=medium
+
+  * tests/test_pep8.py: --ignore E129 too (fix FTBFS with pep8 >= 1.5)
+    (Closes: #759500)
+  * tests/test_auth.py: update 'test_add_key_from_server_mitm' for gnupg 1.4.18,
+    which fail differently/earlier when 'fingerprints do not match' since commit
+    'Screen keyserver responses' (5230304349490f31aa64ee2b69a8a2bc06bf7816).
+    (Closes: #755342)
+
+ -- Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>  Wed, 27 Aug 2014 16:09:14 -0300
+
 python-apt (0.9.3.8) unstable; urgency=medium
 
   * pep8 fixes to fix autopkgtest failure with the most recent
diff -Nru python-apt-0.9.3.8/tests/test_auth.py python-apt-0.9.3.8ppc64el2/tests/test_auth.py
--- python-apt-0.9.3.8/tests/test_auth.py	2014-06-30 08:32:24.000000000 -0300
+++ python-apt-0.9.3.8ppc64el2/tests/test_auth.py	2014-08-27 21:30:44.000000000 -0300
@@ -212,7 +212,10 @@
                     "0101010178F7FE5C3E65D8AF8B48AD6246925553",
                     "hkp://localhost:%d" % self.keyserver_port)
         self.assertTrue(
-            str(cm.exception).startswith("Fingerprints do not match"),
+            str(cm.exception).startswith(
+                "recv from 'hkp://localhost:%d' failed for '%s'" % (
+                    self.keyserver_port,
+                    "0101010178F7FE5C3E65D8AF8B48AD6246925553")),
             cm.exception)
 
     def testAddKeyFromServer(self):
diff -Nru python-apt-0.9.3.8/tests/test_pep8.py python-apt-0.9.3.8ppc64el2/tests/test_pep8.py
--- python-apt-0.9.3.8/tests/test_pep8.py	2014-06-30 08:32:24.000000000 -0300
+++ python-apt-0.9.3.8ppc64el2/tests/test_pep8.py	2014-08-27 21:31:21.000000000 -0300
@@ -16,8 +16,10 @@
              # E126 continuation line over-indented for hanging indent
              # E127 continuation line over-indented for visual indent
              # E128 continuation line under-indented for visual indent
+             # E129 continuation line does not distinguish itself from
+             #      next logical line
              # E265 block comment should start with '# '
-             "--ignore=E125,E126,E127,E128,E265",
+             "--ignore=E125,E126,E127,E128,E129,E265",
              "--exclude", "build,tests/old",
              "--repeat", py_dir])
         if res != 0:

Attachment: python-apt_0.9.3.8ppc64el2_ppc64el.build.xz
Description: application/xz


Reply to: