~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Patch Queue Manager
  • Date: 2012-03-08 16:23:53 UTC
  • mfrom: (6480.1.3 config-cache-bugs)
  • Revision ID: pqm@pqm.ubuntu.com-20120308162353-ccjjxp5qqqhfpygi
(abentley) Add tests for config/config stack bugs.  (Aaron Bentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
694
694
            'Value "not-a-bool" is not valid for "append_revisions_only"',
695
695
            self.warnings[0])
696
696
 
 
697
    def test_use_fresh_values(self):
 
698
        copy = _mod_branch.Branch.open(self.branch.base)
 
699
        copy.lock_write()
 
700
        try:
 
701
            copy.get_config_stack().set('foo', 'bar')
 
702
        finally:
 
703
            copy.unlock()
 
704
        self.assertFalse(self.branch.is_locked())
 
705
        result = self.branch.get_config_stack().get('foo')
 
706
        # Bug: https://bugs.launchpad.net/bzr/+bug/948339
 
707
        self.expectFailure('Unlocked branches cache their configs',
 
708
            self.assertEqual, 'bar', result)
 
709
 
 
710
    def test_set_from_config_get_from_config_stack(self):
 
711
        self.branch.lock_write()
 
712
        self.addCleanup(self.branch.unlock)
 
713
        self.branch.get_config().set_user_option('foo', 'bar')
 
714
        result = self.branch.get_config_stack().get('foo')
 
715
        # https://bugs.launchpad.net/bzr/+bug/948344
 
716
        self.expectFailure('BranchStack uses cache after set_user_option',
 
717
                           self.assertEqual, 'bar', result)
 
718
 
 
719
    def test_set_from_config_stack_get_from_config(self):
 
720
        self.branch.lock_write()
 
721
        self.addCleanup(self.branch.unlock)
 
722
        self.branch.get_config_stack().set('foo', 'bar')
 
723
        self.assertEqual('bar',
 
724
                         self.branch.get_config().get_user_option('foo'))
 
725
 
 
726
    def test_set_delays_write(self):
 
727
        self.branch.lock_write()
 
728
        self.addCleanup(self.branch.unlock)
 
729
        self.branch.get_config_stack().set('foo', 'bar')
 
730
        copy = _mod_branch.Branch.open(self.branch.base)
 
731
        result = copy.get_config_stack().get('foo')
 
732
        # Bug: https://bugs.launchpad.net/bzr/+bug/948339
 
733
        self.expectFailure("Config writes are not cached.", self.assertIs,
 
734
                           None, result)
 
735
 
697
736
 
698
737
class TestPullResult(tests.TestCase):
699
738