~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-30 11:28:39 UTC
  • mfrom: (14606.2.10 apocatest)
  • Revision ID: launchpad@pqm.canonical.com-20111230112839-iogfa6k9x40ymp6c
[r=wgrant][no-qa] Merge canonical.testing into lp.services.testing.

Show diffs side-by-side

added added

removed removed

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