-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
executable file
·70 lines (59 loc) · 2.38 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Tests for the Code Documentation Module
$Id: tests.py 39777 2005-10-31 19:08:20Z jim $
"""
import os
import unittest
from zope.configuration import xmlconfig
from zope.testing import doctest, doctestunit
import zope.app.appsetup.appsetup
from zope.app.testing import placelesssetup
def setUp(test):
placelesssetup.setUp()
meta = '''
<configure
xmlns:meta="http://namespaces.zope.org/meta"
i18n_domain="zope">
<meta:provides feature="devmode" />
<include package="zope.app" file="meta.zcml" />
<include package="zope.app" file="menus.zcml" />
</configure>
'''
xmlconfig.string(meta)
meta = os.path.join(os.path.dirname(zope.app.__file__), 'meta.zcml')
context = xmlconfig.file(meta, zope.app)
context.provideFeature('devmode')
meta = os.path.join(os.path.dirname(zope.app.apidoc.__file__), 'meta.zcml')
context = xmlconfig.file(meta, zope.app.apidoc, context)
# Fix up path for tests.
global old_context
old_context = zope.app.appsetup.appsetup.__config_context
zope.app.appsetup.appsetup.__config_context = context
def tearDown(test):
placelesssetup.tearDown()
global old_context
zope.app.appsetup.appsetup.__config_context = old_context
def test_suite():
return unittest.TestSuite((
doctest.DocFileSuite('README.txt',
setUp=setUp, tearDown=tearDown,
globs={'pprint': doctestunit.pprint},
optionflags=doctest.NORMALIZE_WHITESPACE),
doctest.DocFileSuite('directives.txt',
setUp=placelesssetup.setUp,
tearDown=placelesssetup.tearDown),
))
if __name__ == '__main__':
unittest.main(default="test_suite")