Rev 4927: (vila) Fix failing pycurl test after ModuleFeature addition in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Dec 30 12:57:20 GMT 2009


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

------------------------------------------------------------
revno: 4927 [merge]
revision-id: pqm at pqm.ubuntu.com-20091230125719-o6l0dwzf0gxhkgn1
parent: pqm at pqm.ubuntu.com-20091225133303-vdy4zelx2xdoccfp
parent: v.ladeuil+lp at free.fr-20091230120947-wm3nlgx0dq48np4m
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-12-30 12:57:19 +0000
message:
  (vila) Fix failing pycurl test after ModuleFeature addition
modified:
  bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py	2009-12-21 19:44:51 +0000
+++ b/bzrlib/tests/test_http.py	2009-12-30 12:09:47 +0000
@@ -449,30 +449,31 @@
         support it.
         """
         self.requireFeature(features.pycurl)
+        # Import the module locally now that we now it's available.
+        pycurl = features.pycurl.module
 
         version_info_orig = pycurl.version_info
-        try:
-            # Now that we have pycurl imported, we can fake its version_info
-            # This was taken from a windows pycurl without SSL
-            # (thanks to bialix)
-            pycurl.version_info = lambda : (2,
-                                            '7.13.2',
-                                            462082,
-                                            'i386-pc-win32',
-                                            2576,
-                                            None,
-                                            0,
-                                            None,
-                                            ('ftp', 'gopher', 'telnet',
-                                             'dict', 'ldap', 'http', 'file'),
-                                            None,
-                                            0,
-                                            None)
-            self.assertRaises(errors.DependencyNotPresent, self._transport,
-                              'https://launchpad.net')
-        finally:
-            # Restore the right function
+        def restore():
             pycurl.version_info = version_info_orig
+        self.addCleanup(restore)
+
+        # Fake the pycurl version_info This was taken from a windows pycurl
+        # without SSL (thanks to bialix)
+        pycurl.version_info = lambda : (2,
+                                        '7.13.2',
+                                        462082,
+                                        'i386-pc-win32',
+                                        2576,
+                                        None,
+                                        0,
+                                        None,
+                                        ('ftp', 'gopher', 'telnet',
+                                         'dict', 'ldap', 'http', 'file'),
+                                        None,
+                                        0,
+                                        None)
+        self.assertRaises(errors.DependencyNotPresent, self._transport,
+                          'https://launchpad.net')
 
 
 class TestHTTPConnections(http_utils.TestCaseWithWebserver):




More information about the bazaar-commits mailing list