~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

MergeĀ fromĀ jam-integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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', {}),