~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commands.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-03-25 06:52:38 UTC
  • mfrom: (5018.1.12 lazy-commands)
  • Revision ID: pqm@pqm.ubuntu.com-20100325065238-0mser11okatoq0yz
(mbp) allow builtin commands to be lazy loaded; make bundle-info lazy

Show diffs side-by-side

added added

removed removed

Lines of Context:
211
211
        commands.Command.hooks.install_named_hook(
212
212
            "extend_command", hook_calls.append, None)
213
213
        # create a command, should not fire
214
 
        class ACommand(commands.Command):
 
214
        class cmd_test_extend_command_hook(commands.Command):
215
215
            """A sample command."""
216
 
        cmd = ACommand()
217
216
        self.assertEqual([], hook_calls)
218
217
        # -- as a builtin
219
218
        # register the command class, should not fire
220
219
        try:
221
 
            builtins.cmd_test_extend_command_hook = ACommand
 
220
            commands.builtin_command_registry.register(cmd_test_extend_command_hook)
222
221
            self.assertEqual([], hook_calls)
223
222
            # and ask for the object, should fire
224
223
            cmd = commands.get_cmd_object('test-extend-command-hook')
228
227
            self.assertSubset([cmd], hook_calls)
229
228
            del hook_calls[:]
230
229
        finally:
231
 
            del builtins.cmd_test_extend_command_hook
 
230
            commands.builtin_command_registry.remove('test-extend-command-hook')
232
231
        # -- as a plugin lazy registration
233
232
        try:
234
233
            # register the command class, should not fire