~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ssh_transport.py

  • Committer: Dmitry Vasiliev
  • Date: 2007-03-02 13:44:14 UTC
  • mto: (2327.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2328.
  • Revision ID: dima@hlabs.spb.ru-20070302134414-9mqpmmsii6llb9of
Added comments for test_cached_vendor

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from bzrlib.tests import TestCase
18
18
from bzrlib.errors import SSHVendorNotFound, UnknownSSH
19
19
from bzrlib.transport.ssh import (
20
 
    SSHVendorManager,
21
20
    OpenSSHSubprocessVendor,
 
21
    PLinkSubprocessVendor,
22
22
    SSHCorpSubprocessVendor,
23
 
    PLinkSubprocessVendor,
 
23
    SSHVendorManager,
24
24
    )
25
25
 
26
26
 
84
84
        vendor = object()
85
85
        manager.register_vendor("vendor", vendor)
86
86
        self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})
 
87
        # Once the vendor is found the result is cached (mainly because of the
 
88
        # 'get_vendor' sometimes can be an expensive operation) and later
 
89
        # invocations of the 'get_vendor' just returns the cached value.
87
90
        self.assertIs(manager.get_vendor({"BZR_SSH": "vendor"}), vendor)
88
91
        self.assertIs(manager.get_vendor({}), vendor)
 
92
        # The cache can be cleared by the 'clear_cache' method
 
93
        manager.clear_cache()
 
94
        self.assertRaises(SSHVendorNotFound, manager.get_vendor, {})
89
95
 
90
96
    def test_vendor_getting_methods_precedence(self):
91
97
        manager = TestSSHVendorManager()