~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/http/_urllib2_wrappers.py

Workaround SSLFile wrong readline prototype and fix bogus tests.

* bzrlib/tests/test_read_bundle.py:
(load_tests): Not all tests are parametrized.
(TestDeprecations): Deprecate read_bundle_from_url.
(TestReadBundleFromURL.test_read_mergeable_from_url): Test
read_mergeable_from_url instead of read_bundle_from_url which has
no possible_transports parameter and is deprecated.
(TestReadBundleFromURL.test_read_mergeable_respects_possible_transports):
Fix the test so that it respects the transport class it's supposed
to use.

* bzrlib/transport/http/_urllib2_wrappers.py:
(_ReportingFileSocket.readline): Workaround bug in httplib for
python-2.4 and 2.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        self._report_activity(len(s), 'read')
80
80
        return s
81
81
 
82
 
    def readline(self, size=-1):
83
 
        s = self.filesock.readline(size)
 
82
    def readline(self):
 
83
        # This should be readline(self, size=-1), but httplib in python 2.4 and
 
84
        #  2.5 defines a SSLFile wrapper whose readline method lacks the size
 
85
        #  parameter.  So until we drop support for 2.4 and 2.5 and since we
 
86
        #  don't *need* the size parameter we'll stay with readline(self)
 
87
        #  --  vila 20090209
 
88
        s = self.filesock.readline()
84
89
        self._report_activity(len(s), 'read')
85
90
        return s
86
91