[RFC][PATCH] transport providers

Robert Collins robertc at robertcollins.net
Mon Jan 9 23:40:32 GMT 2006


On Thu, 2006-01-05 at 10:45 -0600, John Arbash Meinel wrote:
> Robert Collins wrote:

> > 
> >>There were a couple of new exceptions that weren't in errors.py, though
> >>it didn't seem bad.
> > 
> > 
> > hmm, I dont recall defining *any* new exceptions in this branch - they
> > already existed elsewhere, just got moved to the relevant transports.
> > Fair comment that we should address them though.
> > 
> > 
> 
> The specific exceptions are WebserverNotAvailable, and BadWebserverPath.
> 
> BadWebserverPath should also not be inheriting from ValueError. But as
> you say, this might have just been in tests/test_http.py, so we didn't
> see it before.

They were. I dont think this should block merging as its no worse than
it was ;0.


> As long as we switch the adapter so that it is possible for plugins to
> add their own tests, I'm happy enough with the system.

There are two uses needed - adding an implementation to be tested by the
stock tests, and adding tests to be tested against all implementations.

For the former, this branch needs some work - I've added 'push
permutations list down into transport modules and allow it to be
extended' into the BRANCH.TODO.

For the latter, this is recipe used to run a single test against all
implementations:

    from bzrlib.transport import TransportTestProviderAdapter
    adapter = TransportTestProviderAdapter()
    test_suite = adapter.adapt(my_test)

the test suite uses this in a loop to load all the tests in a module for
each implementation:

    from bzrlib.transport import TransportTestProviderAdapter
    adapter = TransportTestProviderAdapter()
    for mod_name in test_transport_implementations:
        mod = _load_module_by_name(mod_name)
        for test in iter_suite_tests(loader.loadTestsFromModule(mod)):
            suite.addTests(adapter.adapt(test))


So a plugin can either patch bzrlib.tests.test_transport_implementations
to add its test module, or it can duplicate some or all of the loop if
it wants finer grained control.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060110/e7be3de9/attachment.pgp 


More information about the bazaar mailing list