aboutsummaryrefslogtreecommitdiff
path: root/lava_tool/tests/__init__.py
blob: 5c0f43490d11751901269e0751352496e7b4a602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright (C) 2010 Linaro Limited
#
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
#
# This file is part of lava-tool.
#
# lava-tool is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation
#
# lava-tool is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with lava-tool.  If not, see <http://www.gnu.org/licenses/>.

"""
Package with unit tests for lava_tool
"""

import doctest
import unittest


def app_modules():
    return [
        'lava_tool.commands',
        'lava_tool.dispatcher',
        'lava_tool.interface',
        'lava_dashboard_tool.commands',
    ]


def test_modules():
    return [
        'lava.device.tests.test_commands',
        'lava.device.tests.test_device',
        'lava.helper.tests.test_command',
        'lava.helper.tests.test_dispatcher',
        'lava.helper.tests.test_template',
        'lava.job.tests.test_commands',
        'lava.job.tests.test_job',
        'lava.testdef.tests.test_commands',
        'lava.tests.test_commands',
        'lava.tests.test_config',
        'lava.tests.test_parameter',
        'lava_dashboard_tool.tests.test_commands',
        'lava_tool.tests.test_auth_commands',
        'lava_tool.tests.test_authtoken',
        'lava_tool.tests.test_commands',
        'lava_tool.tests.test_utils',
    ]


def test_suite():
    """
    Build an unittest.TestSuite() object with all the tests in _modules.
    Each module is harvested for both regular unittests and doctests
    """
    modules = app_modules() + test_modules()
    suite = unittest.TestSuite()
    loader = unittest.TestLoader()

    for name in modules:
        unit_suite = loader.loadTestsFromName(name)
        suite.addTests(unit_suite)
        doc_suite = doctest.DocTestSuite(name)
        suite.addTests(doc_suite)
    return suite