/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/tests/test_http.py

Don't use multiple inheritance for http smart medium since we
can't pass parameters to object.__init__ (and bzr used that trick
prior to python-2.6 to implement it).

* bzrlib/tests/test_http.py:
(TestHTTPConnections.test_get_smart_medium): Deleted.

* bzrlib/transport/http/__init__.py:
(HttpTransportBase): Get rid of multiple inheritance from
medium.SmartClientMedium.
(HttpTransportBase.get_smart_medium): Build the medium on demand
but cache it to avoid probing for smart server repeatedly.
(SmartClientHTTPMedium): New class. Transfer get_request,
should_probe and send_http_smart_request from
HttpTransportBase. Keep a weak reference on the http transport to
avoid circular references.
(SmartClientHTTPMedium.send_http_smart_request): Handle the weak
reference.

* bzrlib/transport/remote.py:
(RemoteTransport): Doesn't inherit from SmartClientMedium anymore.

* bzrlib/transport/__init__.py:
(Transport.__init__): Don't pass parameters to object.__init__.


Show diffs side-by-side

added added

removed removed

Lines of Context:
449
449
            '"GET /foo/bar HTTP/1.1" 200 - "-" "bzr/%s'
450
450
            % bzrlib.__version__) > -1)
451
451
 
452
 
    def test_get_smart_medium(self):
453
 
        # For HTTP, get_smart_medium should return the transport object.
454
 
        server = self.get_readonly_server()
455
 
        http_transport = self._transport(server.get_url())
456
 
        medium = http_transport.get_smart_medium()
457
 
        self.assertIs(medium, http_transport)
458
 
 
459
452
    def test_has_on_bogus_host(self):
460
453
        # Get a free address and don't 'accept' on it, so that we
461
454
        # can be sure there is no http handler there, but set a