~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

More doc and ensure that the config is locked when _write_config_file is called.

Show diffs side-by-side

added added

removed removed

Lines of Context:
417
417
        self.path, self.uid, self.gid = path, uid, gid
418
418
 
419
419
    def test_ini_config_ownership(self):
420
 
        """Ensure that chown is happening during _write_config_file.
421
 
        """
 
420
        """Ensure that chown is happening during _write_config_file"""
422
421
        self.requireFeature(features.chown_feature)
423
422
        self.overrideAttr(os, 'chown', self._dummy_chown)
424
423
        self.path = self.uid = self.gid = None
485
484
 
486
485
    def create_config(self, content):
487
486
        c = self.config_class(*self.config_args, _content=content)
 
487
        c.lock_write()
488
488
        c._write_config_file()
 
489
        c.unlock()
489
490
        return c
490
491
 
491
492
    def test_simple_read_access(self):
1166
1167
            global_config = sample_config_text
1167
1168
 
1168
1169
        my_global_config = config.GlobalConfig(_content=global_config)
 
1170
        my_global_config.lock_write()
1169
1171
        my_global_config._write_config_file()
 
1172
        my_global_config.unlock()
1170
1173
        my_location_config = config.LocationConfig(
1171
1174
            my_branch.base, _content=sample_branches_text)
 
1175
        my_location_config.lock_write()
1172
1176
        my_location_config._write_config_file()
 
1177
        my_location_config.unlock()
1173
1178
 
1174
1179
        my_config = config.BranchConfig(my_branch)
1175
1180
        self.my_config = my_config
1242
1247
        my_branch = FakeBranch(location)
1243
1248
        if global_config is not None:
1244
1249
            my_global_config = config.GlobalConfig(_content=global_config)
 
1250
            my_global_config.lock_write()
1245
1251
            my_global_config._write_config_file()
 
1252
            my_global_config.unlock()
1246
1253
        if location_config is not None:
1247
1254
            my_location_config = config.LocationConfig(my_branch.base,
1248
1255
                                                       _content=location_config)
 
1256
            my_location_config.lock_write()
1249
1257
            my_location_config._write_config_file()
 
1258
            my_location_config.unlock()
1250
1259
        my_config = config.BranchConfig(my_branch)
1251
1260
        if branch_data_config is not None:
1252
1261
            my_config.branch.control_files.files['branch.conf'] = \