~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commands.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-09 19:25:42 UTC
  • mto: (5777.5.1 inventoryworkingtree)
  • mto: This revision was merged to the branch mainline in revision 5781.
  • Revision ID: jelmer@samba.org-20110409192542-8bbedp36s7nj928e
Split InventoryTree out of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
        self.assertContainsRe(c.get_help_text(), '--foo')
92
92
 
93
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
 
 
111
 
class TestInvokedAs(tests.TestCase):
112
 
 
113
 
    def test_invoked_as(self):
114
 
        """The command object knows the actual name used to invoke it."""
115
 
        commands.install_bzr_command_hooks()
116
 
        commands._register_builtin_commands()
117
 
        # get one from the real get_cmd_object.
118
 
        c = commands.get_cmd_object('ci')
119
 
        self.assertIsInstance(c, builtins.cmd_commit)
120
 
        self.assertEquals(c.invoked_as, 'ci')
121
 
 
122
 
 
123
94
class TestGetAlias(tests.TestCase):
124
95
 
125
96
    def _get_config(self, config_text):
371
342
        cmds = list(commands.all_command_names())
372
343
        self.assertEqual(['called'], hook_calls)
373
344
        self.assertSubset(['foo', 'bar'], cmds)
 
345
 
 
346
 
 
347
class TestDeprecations(tests.TestCase):
 
348
 
 
349
    def test_shlex_split_unicode_deprecation(self):
 
350
        res = self.applyDeprecated(
 
351
                symbol_versioning.deprecated_in((2, 2, 0)),
 
352
                commands.shlex_split_unicode, 'whatever')