/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_commands.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 18:10:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521181028-zn04pdfw0od9hfj3
Rename brzlib => breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import inspect
19
19
import sys
20
20
 
21
 
from brzlib import (
 
21
from breezy import (
22
22
    builtins,
23
23
    commands,
24
24
    config,
27
27
    tests,
28
28
    trace,
29
29
    )
30
 
from brzlib.commands import display_command
31
 
from brzlib.tests import TestSkipped
 
30
from breezy.commands import display_command
 
31
from breezy.tests import TestSkipped
32
32
 
33
33
 
34
34
class TestCommands(tests.TestCase):
195
195
 
196
196
    def setUp(self):
197
197
        super(TestRegisterLazy, self).setUp()
198
 
        import brzlib.tests.fake_command
199
 
        del sys.modules['brzlib.tests.fake_command']
 
198
        import breezy.tests.fake_command
 
199
        del sys.modules['breezy.tests.fake_command']
200
200
        global lazy_command_imported
201
201
        lazy_command_imported = False
202
202
        commands.install_bzr_command_hooks()
206
206
        commands.plugin_cmds.remove('fake')
207
207
 
208
208
    def assertIsFakeCommand(self, cmd_obj):
209
 
        from brzlib.tests.fake_command import cmd_fake
 
209
        from breezy.tests.fake_command import cmd_fake
210
210
        self.assertIsInstance(cmd_obj, cmd_fake)
211
211
 
212
212
    def test_register_lazy(self):
213
213
        """Ensure lazy registration works"""
214
214
        commands.plugin_cmds.register_lazy('cmd_fake', [],
215
 
                                           'brzlib.tests.fake_command')
 
215
                                           'breezy.tests.fake_command')
216
216
        self.addCleanup(self.remove_fake)
217
217
        self.assertFalse(lazy_command_imported)
218
218
        fake_instance = commands.get_cmd_object('fake')
221
221
 
222
222
    def test_get_unrelated_does_not_import(self):
223
223
        commands.plugin_cmds.register_lazy('cmd_fake', [],
224
 
                                           'brzlib.tests.fake_command')
 
224
                                           'breezy.tests.fake_command')
225
225
        self.addCleanup(self.remove_fake)
226
226
        commands.get_cmd_object('status')
227
227
        self.assertFalse(lazy_command_imported)
228
228
 
229
229
    def test_aliases(self):
230
230
        commands.plugin_cmds.register_lazy('cmd_fake', ['fake_alias'],
231
 
                                           'brzlib.tests.fake_command')
 
231
                                           'breezy.tests.fake_command')
232
232
        self.addCleanup(self.remove_fake)
233
233
        fake_instance = commands.get_cmd_object('fake_alias')
234
234
        self.assertIsFakeCommand(fake_instance)
267
267
        try:
268
268
            # register the command class, should not fire
269
269
            commands.plugin_cmds.register_lazy('cmd_fake', [],
270
 
                                               'brzlib.tests.fake_command')
 
270
                                               'breezy.tests.fake_command')
271
271
            self.assertEqual([], hook_calls)
272
272
            # and ask for the object, should fire
273
273
            cmd = commands.get_cmd_object('fake')