Rev 6487: (abentley) Add tests for config/config stack bugs. (Aaron Bentley) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Mar 8 16:23:53 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6487 [merge]
revision-id: pqm at pqm.ubuntu.com-20120308162353-ccjjxp5qqqhfpygi
parent: pqm at pqm.ubuntu.com-20120306194919-kt7mj6xmhifsgees
parent: aaron at aaronbentley.com-20120308152038-fkzhqevngz3nyl1a
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2012-03-08 16:23:53 +0000
message:
  (abentley) Add tests for config/config stack bugs.  (Aaron Bentley)
modified:
  bzrlib/tests/test_branch.py    test_branch.py-20060116013032-97819aa07b8ab3b5
=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py	2012-02-23 19:45:15 +0000
+++ b/bzrlib/tests/test_branch.py	2012-03-08 16:23:53 +0000
@@ -694,6 +694,45 @@
             'Value "not-a-bool" is not valid for "append_revisions_only"',
             self.warnings[0])
 
+    def test_use_fresh_values(self):
+        copy = _mod_branch.Branch.open(self.branch.base)
+        copy.lock_write()
+        try:
+            copy.get_config_stack().set('foo', 'bar')
+        finally:
+            copy.unlock()
+        self.assertFalse(self.branch.is_locked())
+        result = self.branch.get_config_stack().get('foo')
+        # Bug: https://bugs.launchpad.net/bzr/+bug/948339
+        self.expectFailure('Unlocked branches cache their configs',
+            self.assertEqual, 'bar', result)
+
+    def test_set_from_config_get_from_config_stack(self):
+        self.branch.lock_write()
+        self.addCleanup(self.branch.unlock)
+        self.branch.get_config().set_user_option('foo', 'bar')
+        result = self.branch.get_config_stack().get('foo')
+        # https://bugs.launchpad.net/bzr/+bug/948344
+        self.expectFailure('BranchStack uses cache after set_user_option',
+                           self.assertEqual, 'bar', result)
+
+    def test_set_from_config_stack_get_from_config(self):
+        self.branch.lock_write()
+        self.addCleanup(self.branch.unlock)
+        self.branch.get_config_stack().set('foo', 'bar')
+        self.assertEqual('bar',
+                         self.branch.get_config().get_user_option('foo'))
+
+    def test_set_delays_write(self):
+        self.branch.lock_write()
+        self.addCleanup(self.branch.unlock)
+        self.branch.get_config_stack().set('foo', 'bar')
+        copy = _mod_branch.Branch.open(self.branch.base)
+        result = copy.get_config_stack().get('foo')
+        # Bug: https://bugs.launchpad.net/bzr/+bug/948339
+        self.expectFailure("Config writes are not cached.", self.assertIs,
+                           None, result)
+
 
 class TestPullResult(tests.TestCase):
 




More information about the bazaar-commits mailing list