~milo/lava-tool/lava-167

« back to all changes in this revision

Viewing changes to lava_dashboard_tool/tests/__init__.py

  • Committer: Antonio Terceiro
  • Date: 2013-04-22 17:33:58 UTC
  • mto: This revision was merged to the branch mainline in revision 182.
  • Revision ID: antonio.terceiro@linaro.org-20130422173358-vmhyi0at1xptcm45
Absorb lava-dashboard-tool

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2010,2011 Linaro Limited
 
2
#
 
3
# Author: Zygmunt Krynicki <zygmunt.krynicki@linaro.org>
 
4
#
 
5
# This file is part of lava-dashboard-tool.
 
6
#
 
7
# lava-dashboard-tool is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU Lesser General Public License version 3
 
9
# as published by the Free Software Foundation
 
10
#
 
11
# lava-dashboard-tool is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU Lesser General Public License
 
17
# along with lava-dashboard-tool.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
"""
 
20
Package with unit tests for lava_dashboard_tool
 
21
"""
 
22
 
 
23
import doctest
 
24
import unittest
 
25
 
 
26
 
 
27
def app_modules():
 
28
    return [
 
29
            'lava_dashboard_tool.commands',
 
30
            ]
 
31
 
 
32
 
 
33
def test_modules():
 
34
    return [
 
35
            'lava_dashboard_tool.tests.test_commands',
 
36
            ]
 
37
 
 
38
 
 
39
def test_suite():
 
40
    """
 
41
    Build an unittest.TestSuite() object with all the tests in _modules.
 
42
    Each module is harvested for both regular unittests and doctests
 
43
    """
 
44
    modules = app_modules() + test_modules()
 
45
    suite = unittest.TestSuite()
 
46
    loader = unittest.TestLoader()
 
47
    for name in modules:
 
48
        unit_suite = loader.loadTestsFromName(name)
 
49
        suite.addTests(unit_suite)
 
50
        doc_suite = doctest.DocTestSuite(name)
 
51
        suite.addTests(doc_suite)
 
52
    return suite