[MERGE] overhaul RepositoryTestAdapter

Robert Collins robertc at robertcollins.net
Mon Jul 2 06:27:48 BST 2007


On Mon, 2007-07-02 at 13:55 +1000, Martin Pool wrote:
> I got a 500 message from BB :-(   +1 conditional anyhow.
> 
> 
> I like this way of representing the scenarios.
> 
> Now that the repository test support code is getting on for 200 lines
> it might be good to move it from repository.py into a separate module
> in the test suite.
> 
> If scenarios is going to be public and mutable it should have a
> docstring, mentioning that it will be set by default from the list of
> formats.
> 
> +        def make_new_test_id():
> +            new_id = "%s(%s)" % (new_test.id(), scenario[0])
> +            return lambda: new_id
> +        new_test.id = make_new_test_id()
> 
> Why the inner function, rather than just constructing the lambda directly?

So the lambda is bound to a correct new_id each time. IIRC that is - its
now way outside my short term buffer, but it didn't work without the
local function when I first created it.

> +        :param scenario: A tuple describing the scenarion.
> 
> scenario
> 
> It looks like adapt and adapt_test_to_scenario can move to a base
> class (in the future maybe).

They are on one now? (TestScenarioApplier).

> 
> === modified file bzrlib/tests/repository_implementations/__init__.py
> --- bzrlib/tests/repository_implementations/__init__.py
> +++ bzrlib/tests/repository_implementations/__init__.py
> @@ -49,7 +49,10 @@
>          if format is None:
>              # Create a repository of the type we are trying to test.
>              made_control = self.make_bzrdir(relpath)
> -            return self.repository_format.initialize(made_control)
> +            repo = self.repository_format.initialize(made_control)
> +            if getattr(self, "repository_to_test_repository"):
> +                repo = self.repository_to_test_repository(repo)
> +            return repo
> 
> I don't object to this but it wasn't mentioned in your merge message.

Oh woops. I'll add a NEWS entry for it.

Thanks,
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/20070702/a84e150e/attachment.pgp 


More information about the bazaar mailing list