~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

Merge from integration.

Show diffs side-by-side

added added

removed removed

Lines of Context:
513
513
        self.my_config._get_global_config()._get_parser(global_file)
514
514
 
515
515
    def test_set_user_setting_sets_and_saves(self):
516
 
        # TODO RBC 20051029 test hat mkdir ~/.bazaar is called ..
517
516
        self.get_location_config('/a/c')
518
517
        record = InstrumentedConfigObj("foo")
519
518
        self.my_config._parser = record
520
 
        print ("test_set_user_setting_sets_and_saves broken: creates .bazaar "
521
 
               "in the top-level directory, not inside the test directory")
522
 
        return
523
 
        self.my_config.set_user_option('foo', 'bar')
 
519
 
 
520
        real_mkdir = os.mkdir
 
521
        self.created = False
 
522
        def checked_mkdir(path, mode=0777):
 
523
            self.log('making directory: %s', path)
 
524
            real_mkdir(path, mode)
 
525
            self.created = True
 
526
 
 
527
        os.mkdir = checked_mkdir
 
528
        try:
 
529
            self.my_config.set_user_option('foo', 'bar')
 
530
        finally:
 
531
            os.mkdir = real_mkdir
 
532
 
 
533
        self.failUnless(self.created, 'Failed to create ~/.bazaar')
524
534
        self.assertEqual([('__contains__', '/a/c'),
525
535
                          ('__contains__', '/a/c/'),
526
536
                          ('__setitem__', '/a/c', {}),