~abentley/bzrtools/bzrtools.dev

670 by Aaron Bentley
Use lazy command-loading in bzrtools
1
# Copyright (C) 2008 Canonical Limited.
2
#
3
#    This program is free software; you can redistribute it and/or modify
4
#    it under the terms of the GNU General Public License as published by
5
#    the Free Software Foundation; either version 2 of the License, or
6
#    (at your option) any later version.
7
#
8
#    This program is distributed in the hope that it will be useful,
9
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
10
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
#    GNU General Public License for more details.
12
#
13
#    You should have received a copy of the GNU General Public License
14
#    along with this program; if not, write to the Free Software
15
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
18
from bzrlib.commands import plugin_cmds
19
20
21
commands = {
22
    'cmd_branches': [],
23
    'cmd_branch_history': [],
24
    'cmd_cbranch': [],
25
    'cmd_cdiff': [],
26
    'cmd_clean_tree': [],
27
    'cmd_fetch_ghosts': ['fetch-missing'],
28
    'cmd_graph_ancestry': [],
29
    'cmd_heads': [],
30
    'cmd_import': [],
31
    'cmd_link_tree': [],
32
    'cmd_multi_pull': [],
33
    'cmd_patch': [],
34
    'cmd_rspush': [],
35
    'cmd_shelf': [],
36
    'cmd_shell': [],
37
    'cmd_shelve1': ['shelve'],
38
    'cmd_trees': [],
39
    'cmd_unshelve1': ['unshelve'],
40
    'cmd_zap': [],
41
}
42
43
44
for cmd_name, aliases in commands.items():
45
    plugin_cmds.register_lazy(cmd_name, aliases,
46
                              'bzrlib.plugins.bzrtools.command_classes')
47
48
49
def test_suite():
50
    from bzrlib.tests.TestUtil import TestLoader
51
    import tests
52
    from doctest import DocTestSuite, ELLIPSIS
53
    from unittest import TestSuite
54
    import bzrtools
55
    import tests.clean_tree
56
    import tests.test_dotgraph
57
    import tests.is_clean
58
    import tests.test_cbranch
59
    import tests.test_link_tree
60
    import tests.test_patch
61
    import tests.test_rspush
62
    import tests.upstream_import
63
    import zap
64
    import tests.blackbox
65
    import tests.shelf_tests
66
    result = TestSuite()
67
    result.addTest(DocTestSuite(bzrtools, optionflags=ELLIPSIS))
68
    result.addTest(tests.clean_tree.test_suite())
69
    result.addTest(tests.test_suite())
70
    result.addTest(TestLoader().loadTestsFromModule(tests.shelf_tests))
71
    result.addTest(tests.blackbox.test_suite())
72
    result.addTest(tests.upstream_import.test_suite())
73
    result.addTest(zap.test_suite())
74
    result.addTest(TestLoader().loadTestsFromModule(tests.test_dotgraph))
75
    result.addTest(TestLoader().loadTestsFromModule(tests.is_clean))
76
    result.addTest(TestLoader().loadTestsFromModule(tests.test_link_tree))
77
    result.addTest(TestLoader().loadTestsFromModule(tests.test_patch))
78
    result.addTest(TestLoader().loadTestsFromModule(tests.test_rspush))
79
    result.addTest(TestLoader().loadTestsFromModule(tests.test_cbranch))
80
    return result