[MERGE] Workaround SSLFile wrong readline prototype and fix bogus tests

Martin Pool mbp at sourcefrog.net
Tue Feb 10 06:30:03 GMT 2009

> I ended up fixing them and deprecating read_bundle_from_url in the process (see patch for detailed explanations or ask questions during the review if needed).

It wasn't really clear to me from the patch why you ended up
deprecating it.  I presume it is that to test this properly you need
to be able to pass in a transport or a possible_transports, and this
api which takes only a transport doesn't allow that.  You could have
added a possible_transports parameter?  But since that method is
already apparently a compatibility wrapper on read_mergeable_from_url,
why not deprecate it?  Fair enough.

But I guess in general our style should be to ask the caller to get a
transport rather than doing that in convenience methods all over the

I do sympathize with the whack-a-mole feeling of getting tests to pass
in what should be an unrelated place, particularly if the code over
there already should be deprecated.

This should at least be in NEWS.

+class TestDeprecations(tests.TestCaseInTempDir):
+    def create_test_bundle(self):
+        out, wt = create_bundle_file(self)
+        f = open('test_bundle', 'wb')
+        f.write(out.getvalue())
+        f.close()
+        return wt

Even in tests we should use try/finally/close so that we can clean up
the directory on Win32.

In fact it's not very clear to me at the moment why transport reuse,
good as that is, would cause these kind of test failures or be
relevant to progress reporting breaking https.

But the patch itself seems reasonable so I'll include it in 1.12 and trunk.

Martin <http://launchpad.net/~mbp/>

More information about the bazaar mailing list