~launchpad-pqm/launchpad/devel

9492.1.1 by Karl Fogel
Add utilities/formatdoctest.py and utilities/migrater/, both brought
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4
"""
5
Run the view tests.
6
"""
7
8
import logging
9
import os
10
import unittest
11
14604.1.1 by Curtis Hovey
Separate test-authoring classes from test-running classes.
12
from lp.testing import LaunchpadFunctionalLayer
14578.4.2 by William Grant
Fix a few stragglers.
13
from lp.testing.systemdocs import (
14
    LayeredDocFileSuite,
15
    setUp,
16
    tearDown,
17
    )
9492.1.1 by Karl Fogel
Add utilities/formatdoctest.py and utilities/migrater/, both brought
18
19
20
here = os.path.dirname(os.path.realpath(__file__))
21
22
23
def test_suite():
24
    suite = unittest.TestSuite()
25
    testsdir = os.path.abspath(here)
26
27
    # Add tests using default setup/teardown
28
    filenames = [filename
29
                 for filename in os.listdir(testsdir)
30
                 if filename.endswith('.txt')]
31
    # Sort the list to give a predictable order.
32
    filenames.sort()
33
    for filename in filenames:
34
        path = filename
35
        one_test = LayeredDocFileSuite(
36
            path, setUp=setUp, tearDown=tearDown,
37
            layer=LaunchpadFunctionalLayer,
38
            stdout_logging_level=logging.WARNING
39
            )
40
        suite.addTest(one_test)
41
42
    return suite