~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Vincent Ladeuil
  • Date: 2010-08-23 16:57:52 UTC
  • mto: (5394.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5395.
  • Revision ID: v.ladeuil+lp@free.fr-20100823165752-uu7kdj3p69nn7q7z
Implement _save for LockableConfig too.

* bzrlib/tests/test_config.py:
More simplifications.

* bzrlib/config.py:
(LockableConfig.__init__): Needs to override the IniConfig _save
handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
491
491
        return self.config_class(*self.config_args)
492
492
 
493
493
    def create_config(self, content):
494
 
        c = self.config_class(*self.config_args, _content=content)
495
 
        c.lock_write()
496
 
        c._write_config_file()
497
 
        c.unlock()
 
494
        c = self.config_class(*self.config_args, _content=content, _save=True)
498
495
        return c
499
496
 
500
497
    def test_simple_read_access(self):
1168
1165
        if global_config is None:
1169
1166
            global_config = sample_config_text
1170
1167
 
1171
 
        my_global_config = config.GlobalConfig(_content=global_config)
1172
 
        my_global_config.lock_write()
1173
 
        my_global_config._write_config_file()
1174
 
        my_global_config.unlock()
 
1168
        my_global_config = config.GlobalConfig(_content=global_config,
 
1169
                                               _save=True)
1175
1170
        my_location_config = config.LocationConfig(
1176
 
            my_branch.base, _content=sample_branches_text)
1177
 
        my_location_config.lock_write()
1178
 
        my_location_config._write_config_file()
1179
 
        my_location_config.unlock()
1180
 
 
 
1171
            my_branch.base, _content=sample_branches_text, _save=True)
1181
1172
        my_config = config.BranchConfig(my_branch)
1182
1173
        self.my_config = my_config
1183
1174
        self.my_location_config = my_config._get_location_config()
1248
1239
                          location_config=None, branch_data_config=None):
1249
1240
        my_branch = FakeBranch(location)
1250
1241
        if global_config is not None:
1251
 
            my_global_config = config.GlobalConfig(_content=global_config)
1252
 
            my_global_config.lock_write()
1253
 
            my_global_config._write_config_file()
1254
 
            my_global_config.unlock()
 
1242
            my_global_config = config.GlobalConfig(_content=global_config,
 
1243
                                                   _save=True)
1255
1244
        if location_config is not None:
1256
1245
            my_location_config = config.LocationConfig(my_branch.base,
1257
 
                                                       _content=location_config)
1258
 
            my_location_config.lock_write()
1259
 
            my_location_config._write_config_file()
1260
 
            my_location_config.unlock()
 
1246
                                                       _content=location_config,
 
1247
                                                       _save=True)
1261
1248
        my_config = config.BranchConfig(my_branch)
1262
1249
        if branch_data_config is not None:
1263
1250
            my_config.branch.control_files.files['branch.conf'] = \