~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_sftp_transport.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
297
297
    def setUp(self):
298
298
        self.requireFeature(features.paramiko)
299
299
        super(SSHVendorBadConnection, self).setUp()
300
 
        import bzrlib.transport.ssh
301
300
 
302
301
        # open a random port, so we know nobody else is using it
303
302
        # but don't actually listen on the port.
304
303
        s = socket.socket()
305
304
        s.bind(('localhost', 0))
 
305
        self.addCleanup(s.close)
306
306
        self.bogus_url = 'sftp://%s:%s/' % s.getsockname()
307
307
 
308
 
        orig_vendor = bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor
309
 
        def reset():
310
 
            bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor = orig_vendor
311
 
            s.close()
312
 
        self.addCleanup(reset)
313
 
 
314
308
    def set_vendor(self, vendor):
315
 
        import bzrlib.transport.ssh
316
 
        bzrlib.transport.ssh._ssh_vendor_manager._cached_ssh_vendor = vendor
 
309
        from bzrlib.transport import ssh
 
310
        self.overrideAttr(ssh._ssh_vendor_manager, '_cached_ssh_vendor', vendor)
317
311
 
318
312
    def test_bad_connection_paramiko(self):
319
313
        """Test that a real connection attempt raises the right error"""