~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/transport_util.py

  • Committer: Vincent Ladeuil
  • Date: 2007-09-17 06:50:19 UTC
  • mto: (2831.1.1 bzr.integration)
  • mto: This revision was merged to the branch mainline in revision 2832.
  • Revision ID: v.ladeuil+lp@free.fr-20070917065019-5ox8p0iqdj0cksr9
Review feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
_hooked_scheme = 'hooked'
54
54
 
55
55
def _change_scheme_in(url, actual, desired):
56
 
    assert url.startswith(actual + '://')
 
56
    if not url.startswith(actual + '://'):
 
57
        raise AssertionError('url [%r] does not start with [%r]' % (url,
 
58
                                                                     actual))
57
59
    return desired + url[len(actual):]
58
60
 
59
61
 
65
67
    def __init__(self, base, _from_transport=None):
66
68
        assert base.startswith(_hooked_scheme + '://')
67
69
        # We need to trick the backing transport class about the scheme used
68
 
        # We'll do the reversee when we need to talk to the backing server
 
70
        # We'll do the reverse when we need to talk to the backing server
69
71
        fake_base = _change_scheme_in(base, _hooked_scheme, _backing_scheme)
70
72
        super(InstrumentedTransport, self).__init__(
71
73
            fake_base, _from_transport=_from_transport)