~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commands.py

  • Committer: Andrew Bennetts
  • Date: 2010-03-26 04:47:45 UTC
  • mfrom: (5116 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5117.
  • Revision ID: andrew.bennetts@canonical.com-20100326044745-ubvt5tmse1a17s1f
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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