~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

Merged mailine

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
    def test_config_dir(self):
196
196
        if sys.platform == 'win32':
197
197
            self.assertEqual(config.config_dir(), 
198
 
                r'C:\Documents and Settings\bogus\Application Data\bazaar\2.0')
 
198
                'C:/Documents and Settings/bogus/Application Data/bazaar/2.0')
199
199
        else:
200
200
            self.assertEqual(config.config_dir(), '/home/bogus/.bazaar')
201
201
 
202
202
    def test_config_filename(self):
203
203
        if sys.platform == 'win32':
204
204
            self.assertEqual(config.config_filename(), 
205
 
                r'C:\Documents and Settings\bogus\Application Data\bazaar\2.0\bazaar.conf')
 
205
                'C:/Documents and Settings/bogus/Application Data/bazaar/2.0/bazaar.conf')
206
206
        else:
207
207
            self.assertEqual(config.config_filename(),
208
208
                             '/home/bogus/.bazaar/bazaar.conf')
210
210
    def test_branches_config_filename(self):
211
211
        if sys.platform == 'win32':
212
212
            self.assertEqual(config.branches_config_filename(), 
213
 
                r'C:\Documents and Settings\bogus\Application Data\bazaar\2.0\branches.conf')
 
213
                'C:/Documents and Settings/bogus/Application Data/bazaar/2.0/branches.conf')
214
214
        else:
215
215
            self.assertEqual(config.branches_config_filename(),
216
216
                             '/home/bogus/.bazaar/branches.conf')
507
507
        self.my_config._get_global_config()._get_parser(global_file)
508
508
 
509
509
    def test_set_user_setting_sets_and_saves(self):
510
 
        # TODO RBC 20051029 test hat mkdir ~/.bazaar is called ..
511
510
        self.get_location_config('/a/c')
512
511
        record = InstrumentedConfigObj("foo")
513
512
        self.my_config._parser = record
514
 
        print ("test_set_user_setting_sets_and_saves broken: creates .bazaar "
515
 
               "in the top-level directory, not inside the test directory")
516
 
        return
517
 
        self.my_config.set_user_option('foo', 'bar')
 
513
 
 
514
        real_mkdir = os.mkdir
 
515
        self.created = False
 
516
        def checked_mkdir(path, mode=0777):
 
517
            self.log('making directory: %s', path)
 
518
            real_mkdir(path, mode)
 
519
            self.created = True
 
520
 
 
521
        os.mkdir = checked_mkdir
 
522
        try:
 
523
            self.my_config.set_user_option('foo', 'bar')
 
524
        finally:
 
525
            os.mkdir = real_mkdir
 
526
 
 
527
        self.failUnless(self.created, 'Failed to create ~/.bazaar')
518
528
        self.assertEqual([('__contains__', '/a/c'),
519
529
                          ('__contains__', '/a/c/'),
520
530
                          ('__setitem__', '/a/c', {}),