/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Andrew Bennetts
  • Date: 2007-10-12 05:26:46 UTC
  • mfrom: (2904 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2906.
  • Revision ID: andrew.bennetts@canonical.com-20071012052646-wl95idld3ijjy714
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
211
211
        self.assertIs(co.get_bool('UPPERCASE', 'nonactive'), False)
212
212
 
213
213
 
 
214
erroneous_config = """[section] # line 1
 
215
good=good # line 2
 
216
[section] # line 3
 
217
whocares=notme # line 4
 
218
"""
 
219
class TestConfigObjErrors(TestCase):
 
220
 
 
221
    def test_duplicate_section_name_error_line(self):
 
222
        try:
 
223
            co = ConfigObj(StringIO(erroneous_config), raise_errors=True)
 
224
        except config.configobj.DuplicateError, e:
 
225
            self.assertEqual(3, e.line_number)
 
226
        else:
 
227
            self.fail('Error in config file not detected')
 
228
 
214
229
class TestConfig(TestCase):
215
230
 
216
231
    def test_constructs(self):
887
902
        self.my_config.set_user_option('foo', 'qux')
888
903
        self.assertEqual(self.my_config.get_user_option('foo'), 'baz')
889
904
        
 
905
    def test_get_bzr_remote_path(self):
 
906
        my_config = config.LocationConfig('/a/c')
 
907
        self.assertEqual('bzr', my_config.get_bzr_remote_path())
 
908
        my_config.set_user_option('bzr_remote_path', '/path-bzr')
 
909
        self.assertEqual('/path-bzr', my_config.get_bzr_remote_path())
 
910
        os.environ['BZR_REMOTE_PATH'] = '/environ-bzr'
 
911
        self.assertEqual('/environ-bzr', my_config.get_bzr_remote_path())
 
912
 
890
913
 
891
914
precedence_global = 'option = global'
892
915
precedence_branch = 'option = branch'