Rev 4383: (vila) Fix pycurl/python2.6 broken tests in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed May 27 15:35:35 BST 2009


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

------------------------------------------------------------
revno: 4383
revision-id: pqm at pqm.ubuntu.com-20090527143530-bj2950n49h52cyw3
parent: pqm at pqm.ubuntu.com-20090526151333-3qckrxykl1x7op09
parent: v.ladeuil+lp at free.fr-20090527133841-cam9bhs7ykpsfc10
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-05-27 15:35:30 +0100
message:
  (vila) Fix pycurl/python2.6 broken tests
modified:
  bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
    ------------------------------------------------------------
    revno: 4382.2.1
    revision-id: v.ladeuil+lp at free.fr-20090527133841-cam9bhs7ykpsfc10
    parent: pqm at pqm.ubuntu.com-20090526151333-3qckrxykl1x7op09
    parent: v.ladeuil+lp at free.fr-20090527133141-re2v0y86fnx25r4k
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: trunk
    timestamp: Wed 2009-05-27 15:38:41 +0200
    message:
      Fix pycurl/python2.6 broken tests
    modified:
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
    ------------------------------------------------------------
    revno: 4382.1.2
    revision-id: v.ladeuil+lp at free.fr-20090527133141-re2v0y86fnx25r4k
    parent: v.ladeuil+lp at free.fr-20090527095404-qi6cngledrg72zjf
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: pycurl-tests
    timestamp: Wed 2009-05-27 15:31:41 +0200
    message:
      Fixed as per Martin's review.
    modified:
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
    ------------------------------------------------------------
    revno: 4382.1.1
    revision-id: v.ladeuil+lp at free.fr-20090527095404-qi6cngledrg72zjf
    parent: pqm at pqm.ubuntu.com-20090526151333-3qckrxykl1x7op09
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: pycurl-tests
    timestamp: Wed 2009-05-27 11:54:04 +0200
    message:
      Fix test failures for https/pycurl.
      
      * bzrlib/tests/test_http.py:
      (load_tests): Activity tests for https for pycurl need to use a
      specific transport or the certificate validation will fail.
    modified:
      bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py	2009-05-04 14:48:21 +0000
+++ b/bzrlib/tests/test_http.py	2009-05-27 13:31:41 +0000
@@ -143,7 +143,7 @@
                                              auth_scheme_scenarios)
     tests.multiply_tests(tpa_tests, tpa_scenarios, result)
 
-    # activity: activity on all http versions on all implementations
+    # activity: on all http[s] versions on all implementations
     tpact_tests, remaining_tests = tests.split_suite_by_condition(
         remaining_tests, tests.condition_isinstance((
                 TestActivity,
@@ -151,10 +151,33 @@
     activity_scenarios = [
         ('http', dict(_activity_server=ActivityHTTPServer)),
         ]
+    act_transport_scenarios = [
+        ('urllib', dict(_transport=_urllib.HttpTransport_urllib,)),
+        ]
     if tests.HTTPSServerFeature.available():
         activity_scenarios.append(
             ('https', dict(_activity_server=ActivityHTTPSServer)))
-    tpact_scenarios = tests.multiply_scenarios(tp_scenarios,
+        if pycurl_present:
+            from bzrlib.tests import (
+                ssl_certs,
+                )
+            # FIXME: Until we have a better way to handle self-signed
+            # certificates (like allowing them in a test specific
+            # authentication.conf for example), we need some specialized pycurl
+            # transport for tests.
+            class HTTPS_pycurl_transport(PyCurlTransport):
+
+                def __init__(self, base, _from_transport=None):
+                    super(HTTPS_pycurl_transport, self).__init__(
+                        base, _from_transport)
+                    self.cabundle = str(ssl_certs.build_path('ca.crt'))
+
+            act_transport_scenarios.append(
+                ('pycurl', dict(_transport=HTTPS_pycurl_transport,)))
+
+    tpact_scenarios = tests.multiply_scenarios(
+        tests.multiply_scenarios(act_transport_scenarios,
+                                 protocol_scenarios),
         activity_scenarios)
     tests.multiply_tests(tpact_tests, tpact_scenarios, result)
 




More information about the bazaar-commits mailing list