Back to index

plone3  3.1.7
Classes | Functions | Variables
PortalTransforms.tests.test_transforms Namespace Reference

Classes

class  TransformTest
class  PILTransformsTest

Functions

def initialise
def make_tests
def test_suite

Variables

tuple logger = logging.getLogger('PortalTransforms')
tuple TRANSFORMS_TESTINFO
 TR_NAMES = None

Function Documentation

def PortalTransforms.tests.test_transforms.initialise (   transform,
  normalize,
  pattern 
)

Definition at line 194 of file test_transforms.py.

00194 
00195 def initialise(transform, normalize, pattern):
00196     global TRANSFORMS_TESTINFO
00197     for fname in matching_inputs(pattern):
00198         outname = '%s.out' % fname.split('.')[0]
00199         #print transform, fname, outname
00200         TRANSFORMS_TESTINFO += ((transform, fname, outname, normalize, 0),)
00201 
00202 
00203 # ReST test cases
00204 initialise('Products.PortalTransforms.transforms.rest', normalize_html, "rest*.rst")
00205 # Python test cases
00206 initialise('Products.PortalTransforms.transforms.python', normalize_html, "*.py")
00207 
00208 # FIXME missing tests for image_to_html, st

Here is the call graph for this function:

def PortalTransforms.tests.test_transforms.make_tests (   test_descr = TRANSFORMS_TESTINFO)
generate tests classes from test info

return the list of generated test classes

Definition at line 211 of file test_transforms.py.

00211 
00212 def make_tests(test_descr=TRANSFORMS_TESTINFO):
00213     """generate tests classes from test info
00214 
00215     return the list of generated test classes
00216     """
00217     tests = []
00218     for _transform, tr_input, tr_output, _normalize, _subobjects in test_descr:
00219         # load transform if necessary
00220         if type(_transform) is type(''):
00221             try:
00222                 _transform = load(_transform).register()
00223             except MissingBinary:
00224                 # we are not interessted in tests with missing binaries
00225                 continue
00226             except:
00227                 import traceback
00228                 traceback.print_exc()
00229                 continue
00230 
00231         if TR_NAMES is not None and not _transform.name() in TR_NAMES:
00232             print 'skip test for', _transform.name()
00233             continue
00234 
00235         class TransformTestSubclass(TransformTest):
00236             input = input_file_path(tr_input)
00237             output = output_file_path(tr_output)
00238             transform = _transform
00239             normalize = lambda x, y: _normalize(y)
00240             subobjects = _subobjects
00241 
00242         tests.append(TransformTestSubclass)
00243 
00244     tests.append(PILTransformsTest)
00245     return tests
00246 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 247 of file test_transforms.py.

00247 
00248 def test_suite():
00249     from unittest import TestSuite, makeSuite
00250     suite = TestSuite()
00251     for test in make_tests():
00252         suite.addTest(makeSuite(test))
00253     return suite

Here is the call graph for this function:


Variable Documentation

tuple PortalTransforms.tests.test_transforms.logger = logging.getLogger('PortalTransforms')

Definition at line 26 of file test_transforms.py.

Definition at line 209 of file test_transforms.py.

Definition at line 143 of file test_transforms.py.