Back to index

plone3  3.1.7
Functions | Variables
PortalTransforms.tests.utils Namespace Reference

Functions

def normalize_html
def build_test_suite
def input_file_path
def output_file_path
def matching_inputs
def load

Variables

tuple PREFIX = abspath(dirname(__file__))

Function Documentation

def PortalTransforms.tests.utils.build_test_suite (   package_name,
  module_names,
  required = 1 
)
Utlitity for building a test suite from a package name
and a list of modules.

If required is false, then ImportErrors will simply result
in that module's tests not being added to the returned
suite.

Definition at line 14 of file utils.py.

00014 
00015 def build_test_suite(package_name,module_names,required=1):
00016     """
00017     Utlitity for building a test suite from a package name
00018     and a list of modules.
00019 
00020     If required is false, then ImportErrors will simply result
00021     in that module's tests not being added to the returned
00022     suite.
00023     """
00024 
00025     suite = TestSuite()
00026     try:
00027         for name in module_names:
00028             the_name = package_name+'.'+name
00029             __import__(the_name,globals(),locals())
00030             suite.addTest(modules[the_name].test_suite())
00031     except ImportError:
00032         if required:
00033             raise
00034     return suite

Here is the call graph for this function:

Definition at line 37 of file utils.py.

00037 
00038 def input_file_path(file):
00039     return join(PREFIX, 'input', file)

def PortalTransforms.tests.utils.load (   dotted_name,
  globals = None 
)
load a python module from it's name 

Definition at line 46 of file utils.py.

00046 
00047 def load(dotted_name, globals=None):
00048     """ load a python module from it's name """
00049     mod = __import__(dotted_name, globals)
00050     components = dotted_name.split('.')
00051     for comp in components[1:]:
00052         mod = getattr(mod, comp)
00053     return mod

Definition at line 43 of file utils.py.

00043 
00044 def matching_inputs(pattern):
00045     return [basename(path) for path in glob.glob(join(PREFIX, "input", pattern))]

Here is the call graph for this function:

Definition at line 7 of file utils.py.

00007 
00008 def normalize_html(s):
00009     s = re.sub(r"\s+", " ", s)
00010     s = re.sub(r"(?s)\s+<", "<", s)
00011     s = re.sub(r"(?s)>\s+", ">", s)
00012     s = re.sub(r"\r", "", s)
00013     return s

Definition at line 40 of file utils.py.

00040 
00041 def output_file_path(file):
00042     return join(PREFIX, 'output', file)


Variable Documentation

tuple PortalTransforms.tests.utils.PREFIX = abspath(dirname(__file__))

Definition at line 35 of file utils.py.