~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/lazr/tests/test_doc.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-12-31 00:26:32 UTC
  • mfrom: (14606.4.19 apocaremains-2)
  • Revision ID: launchpad@pqm.canonical.com-20111231002632-67fafhhz150cct3b
[r=wgrant][no-qa] Explode canonical.lazr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
"""Test harness for LAZR doctests."""
5
 
 
6
 
__metaclass__ = type
7
 
__all__ = []
8
 
 
9
 
import doctest
10
 
import os
11
 
 
12
 
from zope.testing.cleanup import cleanUp
13
 
 
14
 
DOCTEST_FLAGS = (
15
 
    doctest.ELLIPSIS |
16
 
    doctest.NORMALIZE_WHITESPACE |
17
 
    doctest.REPORT_NDIFF)
18
 
 
19
 
def setUp(test):
20
 
    """All classes should be new-style."""
21
 
    test.globs['__metaclass__'] = type
22
 
    test.globs['__file__'] = test.filename
23
 
 
24
 
def tearDown(test):
25
 
    """Run registered clean-up function."""
26
 
    cleanUp()
27
 
 
28
 
 
29
 
def test_suite():
30
 
    """See `zope.testing.testrunner`."""
31
 
    tests = sorted(
32
 
        ['../doc/%s' % name
33
 
         for name in os.listdir(
34
 
            os.path.join(os.path.dirname(__file__), '../doc'))
35
 
         if name.endswith('.txt')])
36
 
    return doctest.DocFileSuite(
37
 
        setUp=setUp, tearDown=tearDown, optionflags=DOCTEST_FLAGS, *tests)