/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2007-07-22 15:44:59 UTC
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070722154459-520ws2gnifghkpgy
From review comments, use a private scheme for testing.

* bzrlib/transport/__init__.py:
(_unregister_urlparse_netloc_protocol): New function.

* bzrlib/tests/transport_util.py:
(InstrumentedTransport.__init__): Use a dedicated scheme.
(TestCaseWithConnectionHookedTransport.setUp): Reworked to
register the new transport.
(TestCaseWithConnectionHookedTransport.get_url): Use our dedicated
scheme.
(TestCaseWithConnectionHookedTransport.install_hooks,
TestCaseWithConnectionHookedTransport.reset_hooks): Registering
transport is setUp job.

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
        urlparse.uses_netloc.append(protocol)
157
157
 
158
158
 
 
159
def _unregister_urlparse_netloc_protocol(protocol):
 
160
    """Remove protocol from urlparse netloc parsing.
 
161
 
 
162
    Except for tests, you should never use that function. Using it with 'http',
 
163
    for example, will break all http transports.
 
164
    """
 
165
    if protocol in urlparse.uses_netloc:
 
166
        urlparse.uses_netloc.remove(protocol)
 
167
 
 
168
 
159
169
def unregister_transport(scheme, factory):
160
170
    """Unregister a transport."""
161
171
    l = transport_list_registry.get(scheme)