/
tests.py
98 lines (82 loc) · 3.22 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#############################################################################
#
# Copyright (c) 2006 Zope Foundation 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.
#
##############################################################################
"""catalog package test runner
$Id: tests.py 2918 2005-07-19 22:12:38Z jim $
"""
import unittest
import doctest
from zope.testing import module
import zope.component.testing
import zope.component.factory
import zope.component.interfaces
import zc.catalog
import zc.catalog.interfaces
import BTrees.Interfaces
import BTrees.LOBTree
import BTrees.OLBTree
import BTrees.LFBTree
def setUp32bit(test):
zope.component.testing.setUp(test)
test.globs["btrees_family"] = BTrees.family32
def modSetUp32bit(test):
setUp32bit(test)
module.setUp(test, 'zc.catalog.doctest_test')
def setUp64bit(test):
zope.component.testing.setUp(test)
test.globs["btrees_family"] = BTrees.family64
def modSetUp64bit(test):
setUp64bit(test)
module.setUp(test, 'zc.catalog.doctest_test')
def tearDown(test):
zope.component.testing.tearDown(test)
def modTearDown(test):
module.tearDown(test)
zope.component.testing.tearDown(test)
def test_suite():
tests = unittest.TestSuite((
# 32 bits
doctest.DocFileSuite(
'extentcatalog.txt', setUp=modSetUp32bit, tearDown=modTearDown),
doctest.DocFileSuite(
'setindex.txt', setUp=setUp32bit, tearDown=tearDown),
doctest.DocFileSuite(
'valueindex.txt', setUp=setUp32bit, tearDown=tearDown),
doctest.DocFileSuite(
'normalizedindex.txt', setUp=setUp32bit, tearDown=tearDown),
doctest.DocFileSuite(
'globber.txt', setUp=setUp32bit, tearDown=tearDown),
doctest.DocFileSuite(
'callablewrapper.txt', setUp=setUp32bit, tearDown=tearDown),
# 64 bits
doctest.DocFileSuite(
'extentcatalog.txt', setUp=modSetUp64bit, tearDown=modTearDown),
doctest.DocFileSuite('setindex.txt', setUp=setUp64bit,
tearDown=tearDown),
doctest.DocFileSuite('valueindex.txt', setUp=setUp64bit,
tearDown=tearDown),
doctest.DocFileSuite('normalizedindex.txt', setUp=setUp64bit,
tearDown=tearDown),
doctest.DocFileSuite('globber.txt', setUp=setUp64bit,
tearDown=tearDown),
doctest.DocFileSuite('callablewrapper.txt', setUp=setUp64bit,
tearDown=tearDown),
# legacy data support
doctest.DocFileSuite('legacy.txt', optionflags=doctest.ELLIPSIS),
))
import zc.catalog.stemmer
if not zc.catalog.stemmer.broken:
tests.addTest(doctest.DocFileSuite('stemmer.txt'))
return tests
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')