~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-12-30 12:57:19 UTC
  • mfrom: (4926.1.1 various)
  • Revision ID: pqm@pqm.ubuntu.com-20091230125719-o6l0dwzf0gxhkgn1
(vila) Fix failing pycurl test after ModuleFeature addition

Show diffs side-by-side

added added

removed removed

Lines of Context:
449
449
        support it.
450
450
        """
451
451
        self.requireFeature(features.pycurl)
 
452
        # Import the module locally now that we now it's available.
 
453
        pycurl = features.pycurl.module
452
454
 
453
455
        version_info_orig = pycurl.version_info
454
 
        try:
455
 
            # Now that we have pycurl imported, we can fake its version_info
456
 
            # This was taken from a windows pycurl without SSL
457
 
            # (thanks to bialix)
458
 
            pycurl.version_info = lambda : (2,
459
 
                                            '7.13.2',
460
 
                                            462082,
461
 
                                            'i386-pc-win32',
462
 
                                            2576,
463
 
                                            None,
464
 
                                            0,
465
 
                                            None,
466
 
                                            ('ftp', 'gopher', 'telnet',
467
 
                                             'dict', 'ldap', 'http', 'file'),
468
 
                                            None,
469
 
                                            0,
470
 
                                            None)
471
 
            self.assertRaises(errors.DependencyNotPresent, self._transport,
472
 
                              'https://launchpad.net')
473
 
        finally:
474
 
            # Restore the right function
 
456
        def restore():
475
457
            pycurl.version_info = version_info_orig
 
458
        self.addCleanup(restore)
 
459
 
 
460
        # Fake the pycurl version_info This was taken from a windows pycurl
 
461
        # without SSL (thanks to bialix)
 
462
        pycurl.version_info = lambda : (2,
 
463
                                        '7.13.2',
 
464
                                        462082,
 
465
                                        'i386-pc-win32',
 
466
                                        2576,
 
467
                                        None,
 
468
                                        0,
 
469
                                        None,
 
470
                                        ('ftp', 'gopher', 'telnet',
 
471
                                         'dict', 'ldap', 'http', 'file'),
 
472
                                        None,
 
473
                                        0,
 
474
                                        None)
 
475
        self.assertRaises(errors.DependencyNotPresent, self._transport,
 
476
                          'https://launchpad.net')
476
477
 
477
478
 
478
479
class TestHTTPConnections(http_utils.TestCaseWithWebserver):