147.1.3
by Robert Collins
test and deliver basic pending-merges into bzr so that merging is recorded |
1 |
# arch-tag: cd547407-1daf-41ce-a75b-5fb8f5590f33
|
2 |
# Copyright (C) 2004 Canonical Ltd.
|
|
3 |
# 2004 David Allouche <david@allouche.net>
|
|
4 |
#
|
|
5 |
# This program is free software; you can redistribute it and/or modify
|
|
6 |
# it under the terms of the GNU General Public License as published by
|
|
7 |
# the Free Software Foundation; either version 2 of the License, or
|
|
8 |
# (at your option) any later version.
|
|
9 |
#
|
|
10 |
# This program is distributed in the hope that it will be useful,
|
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU General Public License for more details.
|
|
14 |
#
|
|
15 |
# You should have received a copy of the GNU General Public License
|
|
16 |
# along with this program; if not, write to the Free Software
|
|
17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18 |
||
19 |
"""Test suite
|
|
20 |
"""
|
|
21 |
||
22 |
__all__ = [ |
|
23 |
# Test framework
|
|
24 |
'framework', |
|
25 |
'framework_twisted', |
|
26 |
# Test suites
|
|
27 |
'test_coding', |
|
28 |
'test_namespace', |
|
29 |
'test_escaping', |
|
30 |
'test_output', |
|
31 |
'test_arch', |
|
32 |
'test_revlib', |
|
33 |
'test_twisted', |
|
34 |
'test_twisted_arch', |
|
35 |
# Utility
|
|
36 |
'test_suite', |
|
37 |
'main', |
|
38 |
]
|
|
39 |
||
40 |
import unittest |
|
41 |
||
42 |
def my_import(name): |
|
43 |
mod = __import__(name) |
|
44 |
components = name.split('.') |
|
45 |
for comp in components[1:]: |
|
46 |
mod = getattr(mod, comp) |
|
47 |
return mod |
|
48 |
||
49 |
def test_suite(limit=()): |
|
50 |
excluded = ('test_suite', 'test_twisted', 'test_twisted_arch') |
|
51 |
suite = unittest.TestSuite() |
|
52 |
if limit: |
|
53 |
for test_name in limit: |
|
54 |
components = test_name.split('.') |
|
55 |
assert len(components) in (1,2) |
|
56 |
module_name = components[0] |
|
57 |
module = my_import('%s.test_%s' % (__name__, module_name)) |
|
58 |
module_limit = components[1:] |
|
59 |
suite.addTest(module.test_suite(module_limit)) |
|
60 |
else: |
|
61 |
for module_name in __all__: |
|
62 |
if module_name in excluded: continue |
|
63 |
if not module_name.startswith('test_'): continue |
|
64 |
module = my_import('%s.%s' % (__name__, module_name)) |
|
65 |
suite.addTest(module.test_suite()) |
|
66 |
return suite |
|
67 |
||
68 |
def main(argv): |
|
69 |
from arch.tests import framework |
|
70 |
return framework.run_test_suite(argv, test_suite) |