Rev 5585: (vila) Fix lp plugin test failures related to xmlrpc changes in in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Jan 11 05:21:45 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5585 [merge]
revision-id: pqm at pqm.ubuntu.com-20110111052144-eg3yyt9xcj2jwv93
parent: pqm at pqm.ubuntu.com-20110111042643-kuy4z47p5vxp00tr
parent: v.ladeuil+lp at free.fr-20110111044601-edulagspb2ato6gm
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-01-11 05:21:44 +0000
message:
  (vila) Fix lp plugin test failures related to xmlrpc changes in
  	python-2.7 (Vincent Ladeuil)
modified:
  bzrlib/plugins/launchpad/test_register.py test_register.py-20060315182712-40f5dda945c829a8
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/plugins/launchpad/test_register.py'
--- a/bzrlib/plugins/launchpad/test_register.py	2010-12-16 11:31:14 +0000
+++ b/bzrlib/plugins/launchpad/test_register.py	2011-01-11 04:46:01 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 Canonical Ltd
+# Copyright (C) 2006-2011 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -15,18 +15,16 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 import base64
-import os
 from StringIO import StringIO
 import urlparse
 import xmlrpclib
 
 from bzrlib import (
     config,
-    osutils,
     tests,
     ui,
     )
-from bzrlib.tests import TestCaseWithTransport, TestSkipped
+from bzrlib.tests import TestCaseWithTransport
 
 # local import
 from bzrlib.plugins.launchpad.lp_registration import (
@@ -61,6 +59,25 @@
         """
         return (200, 'OK', [])
 
+    def getresponse(self, buffering=True):
+        """Fake the http reply.
+
+        This is used when running on Python 2.7, where xmlrpclib uses
+        httplib.HTTPConnection in a different way than before.
+        """
+        class FakeHttpResponse(object):
+
+            def __init__(self, status, reason, headers, body):
+                self.status = status
+                self.reason = reason
+                self.headers = headers
+                self.body = body
+
+            def read(self, size=-1):
+                return self.body.read(size)
+
+        return FakeHttpResponse(200, 'OK', [], self.getfile())
+
     def getfile(self):
         """Return a fake file containing the response content."""
         return StringIO('''\
@@ -85,6 +102,7 @@
     def __init__(self, testcase, expect_auth):
         self.testcase = testcase
         self.expect_auth = expect_auth
+        self._connection = (None, None)
 
     def make_connection(self, host):
         host, http_headers, x509 = self.get_host_info(host)

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2011-01-07 11:13:50 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2011-01-11 04:46:01 +0000
@@ -103,6 +103,9 @@
 * Check sphinx compatibility for tests requiring older sphinx versions.
   (Vincent Ladeuil, #688072)
 
+* ``test_onto_transport`` in the Launchpad plugin can now run with Python
+  2.7. (Vincent Ladeuil, #654733)
+
 * ``TestCase._captureVar`` and ``TestCase._old_env`` have been deleted due to
   bug #690563. Test writers are encouraged to use ``TestCase.overrideEnv``
   instead. (Vincent Ladeuil)




More information about the bazaar-commits mailing list