[MERGE] overhaul RepositoryTestAdapter

Martin Pool mbp at sourcefrog.net
Mon Jul 2 04:55:34 BST 2007


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?

+        :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).


=== 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.

-- 
Martin



More information about the bazaar mailing list