Back to index

plone3  3.1.7
base.py
Go to the documentation of this file.
00001 from Products.Five import zcml
00002 from Products.Five import fiveconfigure
00003 
00004 from Testing import ZopeTestCase as ztc
00005 
00006 from Products.PloneTestCase import PloneTestCase as ptc
00007 from Products.PloneTestCase.layer import onsetup
00008 
00009 @onsetup
00010 def setup_product():
00011     """Set up additional products and ZCML required to test this product.
00012     
00013     The @onsetup decorator causes the execution of this body to be deferred
00014     until the setup of the Plone site testing layer.
00015     """
00016     
00017     # Load the ZCML configuration for this package and its dependencies
00018     
00019     fiveconfigure.debug_mode = True
00020     import plone.portlet.static
00021     zcml.load_config('configure.zcml', plone.portlet.static)
00022     fiveconfigure.debug_mode = False
00023     
00024     # We need to tell the testing framework that these products
00025     # should be available. This can't happen until after we have loaded
00026     # the ZCML.
00027     
00028     ztc.installPackage('plone.portlet.static')
00029     
00030 # The order here is important: We first call the deferred function and then 
00031 # let PloneTestCase install it during Plone site setup
00032 
00033 setup_product()
00034 ptc.setupPloneSite(products=['plone.portlet.static'])
00035 
00036 class TestCase(ptc.PloneTestCase):
00037     """Base class used for test cases
00038     """
00039         
00040 class FunctionalTestCase(ptc.FunctionalTestCase):
00041     """Test case class used for functional (doc-)tests
00042     """