~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Patch Queue Manager
  • Date: 2012-03-28 16:13:49 UTC
  • mfrom: (6499.2.3 948339-config-caching)
  • Revision ID: pqm@pqm.ubuntu.com-20120328161349-2gsc0g11fcu43hlc
(vila) Properly share mutable config sections and save the branch config
 only during the final unlock (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2860
2860
        store.save()
2861
2861
        self.assertEquals(False, self.has_store(store))
2862
2862
 
 
2863
    def test_mutable_section_shared(self):
 
2864
        store = self.get_store(self)
 
2865
        store._load_from_string('foo=bar\n')
 
2866
        # FIXME: There should be a better way than relying on the test
 
2867
        # parametrization to identify branch.conf -- vila 2011-0526
 
2868
        if self.store_id in ('branch', 'remote_branch'):
 
2869
            # branch stores requires write locked branches
 
2870
            self.addCleanup(store.branch.lock_write().unlock)
 
2871
        section1 = store.get_mutable_section(None)
 
2872
        section2 = store.get_mutable_section(None)
 
2873
        # If we get different sections, different callers won't share the
 
2874
        # modification
 
2875
        self.assertIs(section1, section2)
 
2876
 
2863
2877
    def test_save_emptied_succeeds(self):
2864
2878
        store = self.get_store(self)
2865
2879
        store._load_from_string('foo=bar\n')