~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commands.py

  • Committer: Vincent Ladeuil
  • Date: 2011-09-29 13:54:10 UTC
  • mto: This revision was merged to the branch mainline in revision 6178.
  • Revision ID: v.ladeuil+lp@free.fr-20110929135410-gv714ay1lg6ttehv
Get rid of the --override-config long name, ensures the overrides are resest when the command has run.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
                commands_without_help.append(cmd_name)
45
45
        self.assertLength(0, commands_without_help)
46
46
 
47
 
    def test_command_see_config_overrides(self):
48
 
        self.run_bzr(['rocks', '-Oxx=12', '--override-config', 'yy=foo'])
49
 
        c = config.GlobalStack()
50
 
        self.assertEquals('12', c.get('xx'))
51
 
        self.assertEquals('foo', c.get('yy'))
52
 
 
53
47
    def test_display_command(self):
54
48
        """EPIPE message is selectively suppressed"""
55
49
        def pipe_thrower():
97
91
        self.assertContainsRe(c.get_help_text(), '--foo')
98
92
 
99
93
 
 
94
class TestInsideCommand(tests.TestCaseInTempDir):
 
95
 
 
96
    def test_command_see_config_overrides(self):
 
97
        def run(cmd):
 
98
            # We override the run() command method so we can observe the
 
99
            # overrides from inside.
 
100
            c = config.GlobalStack()
 
101
            self.assertEquals('12', c.get('xx'))
 
102
            self.assertEquals('foo', c.get('yy'))
 
103
        self.overrideAttr(builtins.cmd_rocks, 'run', run)
 
104
        self.run_bzr(['rocks', '-Oxx=12', '-Oyy=foo'])
 
105
        c = config.GlobalStack()
 
106
        # Ensure that we don't leak outside of the command
 
107
        self.assertEquals(None, c.get('xx'))
 
108
        self.assertEquals(None, c.get('yy'))
 
109
 
 
110
 
100
111
class TestInvokedAs(tests.TestCase):
101
112
 
102
113
    def test_invoked_as(self):