1
# Copyright 2012 Canonical Ltd. This software is licensed under the
1
# Copyright 2009 Canonical Ltd. This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
5
5
Run the doctests and pagetests.
10
from lp.services.testing import build_test_suite
12
from canonical.database.sqlbase import flush_database_updates
13
from canonical.launchpad.testing.pages import PageTestSuite
14
from canonical.launchpad.testing.systemdocs import (
15
LayeredDocFileSuite, setUp, tearDown)
16
from canonical.testing import (
17
DatabaseFunctionalLayer, DatabaseLayer, LaunchpadFunctionalLayer,
18
LaunchpadZopelessLayer)
19
from lp.registry.tests import mailinglists_helper
13
22
here = os.path.dirname(os.path.realpath(__file__))
19
return build_test_suite(here, special)
29
suite = unittest.TestSuite()
31
stories_dir = os.path.join(os.path.pardir, 'stories')
32
suite.addTest(PageTestSuite(stories_dir))
33
stories_path = os.path.join(here, stories_dir)
34
for story_dir in os.listdir(stories_path):
35
full_story_dir = os.path.join(stories_path, story_dir)
36
if not os.path.isdir(full_story_dir):
38
story_path = os.path.join(stories_dir, story_dir)
39
suite.addTest(PageTestSuite(story_path))
41
testsdir = os.path.abspath(
42
os.path.normpath(os.path.join(here, os.path.pardir, 'doc'))
45
# Add special needs tests
46
for key in sorted(special):
47
special_suite = special[key]
48
suite.addTest(special_suite)
50
# Add tests using default setup/teardown
52
for filename in os.listdir(testsdir)
53
if filename.endswith('.txt') and filename not in special]
54
# Sort the list to give a predictable order.
56
for filename in filenames:
57
path = os.path.join('../doc/', filename)
58
one_test = LayeredDocFileSuite(
59
path, setUp=setUp, tearDown=tearDown,
60
layer=LaunchpadFunctionalLayer,
61
stdout_logging_level=logging.WARNING
63
suite.addTest(one_test)