Rev 5357: Add a test for concurrent writers ensuring the values propagate. in file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Jul 22 09:12:15 BST 2010


At file:///home/vila/src/bzr/bugs/525571-lock-bazaar-conf-files/

------------------------------------------------------------
revno: 5357
revision-id: v.ladeuil+lp at free.fr-20100722081215-qvjirmudwj527spb
parent: v.ladeuil+lp at free.fr-20100722080002-0jeq5fuanka2hpsh
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: lockable-config-files
timestamp: Thu 2010-07-22 10:12:15 +0200
message:
  Add a test for concurrent writers ensuring the values propagate.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2010-07-22 07:56:13 +0000
+++ b/bzrlib/tests/test_config.py	2010-07-22 08:12:15 +0000
@@ -458,6 +458,20 @@
         # The second update respect the first one
         self.assertEquals('ONE', c2.get_user_option('one'))
 
+    def test_last_speaker_wins(self):
+        # If the same config is not shared, the same variable modified twice
+        # can only see a single result.
+        c1 = self.config
+        c2 = self.create_config(self._content)
+        c1.set_user_option('one', 'c1')
+        c2.set_user_option('one', 'c2')
+        self.assertEquals('c2', c2._get_user_option('one'))
+        # The first modification is still available until another refresh
+        # occur
+        self.assertEquals('c1', c1._get_user_option('one'))
+        c1.set_user_option('two', 'done')
+        self.assertEquals('c2', c1._get_user_option('one'))
+
 
 class TestGetUserOptionAs(TestIniConfig):
 



More information about the bazaar-commits mailing list