Back to index

plone3  3.1.7
atsitetestcase.py
Go to the documentation of this file.
00001 from Testing.ZopeTestCase import Functional
00002 from Products.Archetypes.tests import attestcase
00003 from Products.PloneTestCase.setup import portal_name
00004 from Products.PloneTestCase.setup import portal_owner
00005 import sys, code
00006 
00007 from Products.PloneTestCase import PloneTestCase
00008 
00009 class ATSiteTestCase(PloneTestCase.PloneTestCase, attestcase.ATTestCase):
00010     """AT test case with Plone site
00011     """
00012 
00013 
00014 class ATFunctionalSiteTestCase(Functional, ATSiteTestCase):
00015     """AT test case for functional tests with Plone site
00016     """
00017     
00018     def interact(self, locals=None):
00019         """Provides an interactive shell aka console inside your testcase.
00020         
00021         It looks exact like in a doctestcase and you can copy and paste
00022         code from the shell into your doctest. The locals in the testcase are 
00023         available, becasue you are in the testcase.
00024     
00025         In your testcase or doctest you can invoke the shell at any point by
00026         calling::
00027             
00028             >>> interact( locals() )        
00029             
00030         locals -- passed to InteractiveInterpreter.__init__()
00031         """
00032         savestdout = sys.stdout
00033         sys.stdout = sys.stderr
00034         sys.stderr.write('\n'+'='*70)
00035         console = code.InteractiveConsole(locals)
00036         console.interact("""
00037 DocTest Interactive Console - (c) BlueDynamics Alliance, Austria, 2006
00038 Note: You have the same locals available as in your test-case. 
00039 Ctrl-D ends session and continues testing.
00040 """)
00041         sys.stdout.write('\nend of DocTest Interactive Console session\n')
00042         sys.stdout.write('='*70+'\n')
00043         sys.stdout = savestdout
00044 
00045 
00046 __all__ = ('ATSiteTestCase', 'ATFunctionalSiteTestCase', 'portal_name',
00047            'portal_owner')