~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/testing/__init__.py

  • Committer: William Grant
  • Date: 2011-12-30 07:08:24 UTC
  • mfrom: (14606.2.10 apocatest)
  • mto: This revision was merged to the branch mainline in revision 14610.
  • Revision ID: william.grant@canonical.com-20111230070824-j5qaapyxh3zehhfm
Merge apocatest.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
# This import registers the 'doctest' Unicode codec.
25
25
import lp.services.testing.doctestcodec
26
 
from lp.testing.layers import DatabaseFunctionalLayer
27
 
from lp.testing.pages import PageTestSuite
28
26
from lp.testing.systemdocs import (
29
27
    LayeredDocFileSuite,
30
28
    setUp,
33
31
 
34
32
 
35
33
def build_doctest_suite(base_dir, tests_path, special_tests={},
36
 
                        layer=DatabaseFunctionalLayer,
37
 
                        setUp=setUp, tearDown=tearDown,
 
34
                        layer=None, setUp=setUp, tearDown=tearDown,
38
35
                        package=None):
39
36
    """Build the doc test suite."""
 
37
    from lp.testing.layers import DatabaseFunctionalLayer
 
38
    if layer is None:
 
39
        layer = DatabaseFunctionalLayer
40
40
    suite = unittest.TestSuite()
41
41
    # Tests are run relative to the calling module, not this module.
42
42
    if package is None:
62
62
 
63
63
 
64
64
def build_test_suite(base_dir, special_tests={},
65
 
                     layer=DatabaseFunctionalLayer,
66
 
                     setUp=setUp, tearDown=tearDown):
 
65
                     layer=None, setUp=setUp, tearDown=tearDown):
67
66
    """Build a test suite from a directory containing test files.
68
67
 
69
68
    The parent's 'stories' subdirectory will be checked for pagetests and
79
78
 
80
79
    :param layer: The layer in which to run the tests.
81
80
    """
 
81
    from lp.testing.layers import DatabaseFunctionalLayer
 
82
    from lp.testing.pages import PageTestSuite
 
83
    if layer is None:
 
84
        layer = DatabaseFunctionalLayer
 
85
 
82
86
    suite = unittest.TestSuite()
83
87
 
84
88
    # Tests are run relative to the calling module, not this module.