~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commands.py

(gz) Remove bzrlib/util/elementtree/ package (Martin Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    config,
25
25
    errors,
26
26
    option,
27
 
    symbol_versioning,
28
27
    tests,
29
28
    )
30
29
from bzrlib.commands import display_command
91
90
        self.assertContainsRe(c.get_help_text(), '--foo')
92
91
 
93
92
 
 
93
class TestInsideCommand(tests.TestCaseInTempDir):
 
94
 
 
95
    def test_command_see_config_overrides(self):
 
96
        def run(cmd):
 
97
            # We override the run() command method so we can observe the
 
98
            # overrides from inside.
 
99
            c = config.GlobalStack()
 
100
            self.assertEquals('12', c.get('xx'))
 
101
            self.assertEquals('foo', c.get('yy'))
 
102
        self.overrideAttr(builtins.cmd_rocks, 'run', run)
 
103
        self.run_bzr(['rocks', '-Oxx=12', '-Oyy=foo'])
 
104
        c = config.GlobalStack()
 
105
        # Ensure that we don't leak outside of the command
 
106
        self.assertEquals(None, c.get('xx'))
 
107
        self.assertEquals(None, c.get('yy'))
 
108
 
 
109
 
94
110
class TestInvokedAs(tests.TestCase):
95
111
 
96
112
    def test_invoked_as(self):
354
370
        cmds = list(commands.all_command_names())
355
371
        self.assertEqual(['called'], hook_calls)
356
372
        self.assertSubset(['foo', 'bar'], cmds)
357
 
 
358
 
 
359
 
class TestDeprecations(tests.TestCase):
360
 
 
361
 
    def test_shlex_split_unicode_deprecation(self):
362
 
        res = self.applyDeprecated(
363
 
                symbol_versioning.deprecated_in((2, 2, 0)),
364
 
                commands.shlex_split_unicode, 'whatever')