Rev 5451: Clarify TestConfigGetOptions.setUp() intent and note that scenarios should really be dicts and not lists. in file:///home/vila/src/bzr/experimental/config/

Vincent Ladeuil v.ladeuil+lp at free.fr
Sat Oct 2 11:48:48 BST 2010


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

------------------------------------------------------------
revno: 5451
revision-id: v.ladeuil+lp at free.fr-20101002104848-jmt7vykl4k5i23i3
parent: v.ladeuil+lp at free.fr-20101001095208-vupdrq1jtle74gk7
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: next
timestamp: Sat 2010-10-02 12:48:48 +0200
message:
  Clarify TestConfigGetOptions.setUp() intent and note that scenarios should really be dicts and not lists.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2010-10-01 09:52:08 +0000
+++ b/bzrlib/tests/test_config.py	2010-10-02 10:48:48 +0000
@@ -52,6 +52,21 @@
           'config_section': '.'}),]
 
 
+def config_scenarios():
+    """The scenarios allowing test  to be exercised against all know configs.
+
+    This should provide the necessary environement to use a *valid* config.
+    """
+    # The scenario name must be unique so we may as well use a dict rather than
+    # a list.
+    scenarios = {
+        'bazaar': {},
+        'locations': {},
+        'branch': {}
+        }
+    return [(name, parameters) for name, parameters in scenarios]
+
+
 def load_tests(standard_tests, module, loader):
     suite = loader.suiteClass()
 
@@ -1475,10 +1490,13 @@
 
     def setUp(self):
         super(TestConfigGetOptions, self).setUp()
-        self.global_config = config.GlobalConfig()
         self.tree = self.make_branch_and_tree('.')
         self.branch_config = config.BranchConfig(self.tree.branch)
+        # We could get the locations and global config from the branch config,
+        # but this would rely on an implementation detail and use the same
+        # number of code lines...
         self.locations_config = config.LocationConfig(self.tree.basedir)
+        self.global_config = config.GlobalConfig()
 
     def assertOptions(self, expected, conf):
         actual = list(conf.get_options())



More information about the bazaar-commits mailing list