~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_debug.py

  • Committer: Jelmer Vernooij
  • Date: 2016-04-03 16:32:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6617.
  • Revision ID: jelmer@jelmer.uk-20160403163231-h72bo0uyek2gikw0
Don't put French text in doc/en/user-reference when LANGUAGE=fr_CH.UTF_8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
class TestDebugFlags(tests.TestCaseInTempDir):
28
28
 
29
 
    def test_set_debug_flags_from_config(self):
30
 
        # test both combinations because configobject automatically splits up
31
 
        # comma-separated lists
32
 
        self.try_debug_flags(['hpss', 'error'], 'debug_flags = hpss, error\n')
33
 
        self.try_debug_flags(['hpss'], 'debug_flags = hpss\n')
34
 
 
35
 
    def try_debug_flags(self, expected_flags, conf_bytes):
36
 
        conf = config.GlobalConfig.from_string(conf_bytes, save=True)
 
29
    def test_set_no_debug_flags_from_config(self):
 
30
        self.assertDebugFlags([], '')
 
31
 
 
32
    def test_set_single_debug_flags_from_config(self):
 
33
        self.assertDebugFlags(['hpss'], 'debug_flags = hpss\n')
 
34
 
 
35
    def test_set_multiple_debug_flags_from_config(self):
 
36
        self.assertDebugFlags(['hpss', 'error'], 'debug_flags = hpss, error\n')
 
37
 
 
38
    def assertDebugFlags(self, expected_flags, conf_bytes):
 
39
        conf = config.GlobalStack()
 
40
        conf.store._load_from_string('[DEFAULT]\n' + conf_bytes)
 
41
        conf.store.save()
37
42
        self.overrideAttr(debug, 'debug_flags', set())
38
43
        debug.set_debug_flags_from_config()
39
44
        self.assertEqual(set(expected_flags), debug.debug_flags)