/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

Warn if a config variable can't be interpreted as a boolean

Show diffs side-by-side

added added

removed removed

Lines of Context:
406
406
        get_bool = conf.get_user_option_as_bool
407
407
        self.assertEqual(True, get_bool('a_true_bool'))
408
408
        self.assertEqual(False, get_bool('a_false_bool'))
 
409
        warnings = []
 
410
        def warning(*args):
 
411
            warnings.append(args[0] % args[1:])
 
412
        self.overrideAttr(trace, 'warning', warning)
 
413
        msg = 'Value "%s" is not a boolean for "%s"'
409
414
        self.assertIs(None, get_bool('an_invalid_bool'))
 
415
        self.assertEquals(msg % ('maybe', 'an_invalid_bool'), warnings[0])
 
416
        warnings = []
410
417
        self.assertIs(None, get_bool('not_defined_in_this_config'))
411
 
 
 
418
        self.assertEquals([], warnings)
412
419
 
413
420
    def test_get_user_option_as_list(self):
414
421
        conf, parser = self.make_config_parser("""