[RFC] Multipart support for _urllib_

Martin Pool mbp at canonical.com
Thu Jun 22 03:56:48 BST 2006


On 22 Jun 2006, Michael Ellerman <michael at ellerman.id.au> wrote:
> On 6/21/06, John Arbash Meinel <john at arbash-meinel.com> wrote:
> 
> Yeah, that's what threw me, the transport tests require a bit of
> reading before it's obvious what's going on. But I think I grok it
> now.

There are a few cases where we want to run a set of tests against all
the implementations providing the interface being tested.  UnitTest
doesn't support this amazingly well but we can do it.  I like that we
can do it but the amount of copy&paste required to do it should be
reduced. 

Separately there are some tests that want a transport, but don't need to
be repeated for every one.  Many of the tests that create repositories
are like this.

> I was thinking of making it static on HttpTransportBase, because I
> don't see it really having any use outside of Http, after all they're
> HTTP byte ranges that we're talking about. I've also found
> test_http.py which I think I'll hack on.

That sounds like a reasonable place for it; things which don't
particularly depend on the state of an object are easier to test if
they're static or class methods or regular functions.  And as I said
before for the particular case of _offsets_to_ranges a couple of
examples as doctests would help explain it.

And in general if you don't know how to test something it's much better
to ask than to not ask.

Also I can recommend Kent Beck's "Test Driven Development by Example"
for general background and tips on how to get unstuck from "how do i
test this?".

-- 
Martin




More information about the bazaar mailing list