Back to index

plone3  3.1.7
tests.py
Go to the documentation of this file.
00001 import os, sys, unittest
00002 
00003 from zope.testing import doctest
00004 
00005 from zope.app.testing.placelesssetup import setUp, tearDown
00006 from zope.configuration.xmlconfig import XMLConfig
00007 
00008 optionflags = doctest.REPORT_ONLY_FIRST_FAILURE | doctest.ELLIPSIS
00009 
00010 import zope.app.component
00011 import plone.memoize
00012 
00013 def configurationSetUp(test):
00014     setUp()    
00015     
00016     XMLConfig('meta.zcml', zope.app.component)()
00017     XMLConfig('configure.zcml', plone.memoize)()
00018 
00019 def configurationTearDown(test):
00020     tearDown()
00021 
00022 def test_suite():
00023     try:
00024         from zope.publisher.interfaces.browser import IBrowserView, IBrowserRequest
00025     except ImportError:
00026         from zope.app.publisher.interfaces.browser import IBrowserView
00027         from zope.publisher.interfaces.browser import IBrowserRequest
00028     from zope.component import adapts
00029     from zope.component import provideAdapter
00030     from zope.interface import implements, Interface
00031 
00032     tests = (
00033         doctest.DocTestSuite('plone.memoize.compress',
00034                              setUp=configurationSetUp,
00035                              tearDown=configurationTearDown),
00036         doctest.DocFileSuite('instance.txt', 
00037                              package="plone.memoize",
00038                              setUp=configurationSetUp,
00039                              tearDown=configurationTearDown,
00040                              optionflags=optionflags,
00041                              globs=locals()),
00042         doctest.DocFileSuite('view.txt', 
00043                              package="plone.memoize",
00044                              setUp=configurationSetUp,
00045                              tearDown=configurationTearDown,
00046                              optionflags=optionflags,
00047                              globs=locals()),
00048         doctest.DocFileSuite('forever.txt', 
00049                              package="plone.memoize",
00050                              setUp=configurationSetUp,
00051                              tearDown=configurationTearDown,
00052                              optionflags=optionflags,
00053                              globs=locals()),
00054         doctest.DocFileSuite('README.txt'),
00055         doctest.DocTestSuite('plone.memoize.request',
00056                              setUp=configurationSetUp,
00057                              tearDown=configurationTearDown),
00058         doctest.DocTestSuite('plone.memoize.volatile'),
00059         doctest.DocTestSuite('plone.memoize.ram',
00060                              setUp=configurationSetUp,
00061                              tearDown=configurationTearDown),
00062         )
00063 
00064     return unittest.TestSuite(tests)
00065 
00066 
00067 if __name__=="__main__":
00068     import unittest
00069     unittest.TextTestRunner().run(test_suite())