Rev 5774: Start parameterizing stack tests. in file:///home/vila/src/bzr/experimental/config/

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue May 3 14:00:18 UTC 2011


At file:///home/vila/src/bzr/experimental/config/

------------------------------------------------------------
revno: 5774
revision-id: v.ladeuil+lp at free.fr-20110503140018-f7i5f7ankhqgnevc
parent: v.ladeuil+lp at free.fr-20110503121121-zaps1ohfx9oy4ryl
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: config-concrete-stacks
timestamp: Tue 2011-05-03 16:00:18 +0200
message:
  Start parameterizing stack tests.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-05-03 12:11:21 +0000
+++ b/bzrlib/config.py	2011-05-03 14:00:18 +0000
@@ -2511,7 +2511,7 @@
         return "<config.%s(%s)>" % (self.__class__.__name__, id(self))
 
 
-class GlobalStack(ConfigStack):
+class GlobalStack(Stack):
 
     def __init__(self):
         # Get a GlobalStore
@@ -2520,7 +2520,7 @@
                                           gstore.get_mutable_section)
 
 
-class LocationStack(ConfigStack):
+class LocationStack(Stack):
 
     def __init__(self, location):
         lstore = LocationStore()
@@ -2531,7 +2531,7 @@
             lstore.get_mutable_section)
 
 
-class BranchStack(ConfigStack):
+class BranchStack(Stack):
 
     def __init__(self, branch):
         bstore = BranchStore(branch)

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-05-03 12:11:21 +0000
+++ b/bzrlib/tests/test_config.py	2011-05-03 14:00:18 +0000
@@ -85,6 +85,14 @@
 test_store_builder_registry.register(
     'branch', lambda test: config.BranchStore(test.branch))
 
+# FIXME: Same remark as above for the following registry -- vila 20110503
+test_stack_builder_registry = registry.Registry()
+test_stack_builder_registry.register(
+    'bazaar', lambda test: config.GlobalStack())
+test_stack_builder_registry.register(
+    'location', lambda test: config.LocationStack('.'))
+test_stack_builder_registry.register(
+    'branch', lambda test: config.BranchStack(test.branch))
 
 
 sample_long_alias="log -r-15..-1 --line"
@@ -2257,17 +2265,15 @@
 
 class TestConcreteStacks(tests.TestCaseWithTransport):
 
-    # basic smoke tests
-
-    def test_global_stack(self):
-        stack = config.GlobalStack()
-
-    def test_location_store(self):
-        stack = config.LocationStack('.')
-
-    def test_branch_store(self):
-        b = self.make_branch('.')
-        stack = config.BranchStack(b)
+    scenarios = [(key, {'get_stack': builder})
+                 for key, builder in test_stack_builder_registry.iteritems()]
+
+    def setUp(self):
+        super(TestConcreteStacks, self).setUp()
+        self.branch = self.make_branch('branch')
+
+    def test_build_stack(self):
+        stack = self.get_stack(self)
 
 
 class TestConfigGetOptions(tests.TestCaseWithTransport, TestOptionsMixin):



More information about the bazaar-commits mailing list