Back to index

python3.2  3.2.2
Classes | Functions | Variables
unittest.loader Namespace Reference

Classes

class  TestLoader

Functions

def _make_failed_import_test
def _make_failed_load_tests
def _make_failed_test
def _makeLoader
def getTestCaseNames
def makeSuite
def findTestCases

Variables

 __unittest = True
tuple VALID_MODULE_NAME = re.compile(r'[_a-z]\w*\.py$', re.IGNORECASE)
tuple defaultTestLoader = TestLoader()

Detailed Description

Loading unittests.

Function Documentation

def unittest.loader._make_failed_import_test (   name,
  suiteClass 
) [private]

Definition at line 22 of file loader.py.

00022 
00023 def _make_failed_import_test(name, suiteClass):
00024     message = 'Failed to import test module: %s\n%s' % (name, traceback.format_exc())
00025     return _make_failed_test('ModuleImportFailure', name, ImportError(message),
00026                              suiteClass)

Here is the call graph for this function:

Here is the caller graph for this function:

def unittest.loader._make_failed_load_tests (   name,
  exception,
  suiteClass 
) [private]

Definition at line 27 of file loader.py.

00027 
00028 def _make_failed_load_tests(name, exception, suiteClass):
00029     return _make_failed_test('LoadTestsFailure', name, exception, suiteClass)

Here is the call graph for this function:

Here is the caller graph for this function:

def unittest.loader._make_failed_test (   classname,
  methodname,
  exception,
  suiteClass 
) [private]

Definition at line 30 of file loader.py.

00030 
00031 def _make_failed_test(classname, methodname, exception, suiteClass):
00032     def testFailure(self):
00033         raise exception
00034     attrs = {methodname: testFailure}
00035     TestClass = type(classname, (case.TestCase,), attrs)
00036     return suiteClass((TestClass(methodname),))
00037 

Here is the caller graph for this function:

def unittest.loader._makeLoader (   prefix,
  sortUsing,
  suiteClass = None 
) [private]

Definition at line 302 of file loader.py.

00302 
00303 def _makeLoader(prefix, sortUsing, suiteClass=None):
00304     loader = TestLoader()
00305     loader.sortTestMethodsUsing = sortUsing
00306     loader.testMethodPrefix = prefix
00307     if suiteClass:
00308         loader.suiteClass = suiteClass
00309     return loader

Here is the caller graph for this function:

def unittest.loader.findTestCases (   module,
  prefix = 'test',
  sortUsing = util.three_way_cmp,
  suiteClass = suite.TestSuite 
)

Definition at line 319 of file loader.py.

00319 
00320                   suiteClass=suite.TestSuite):
00321     return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromModule(\
00322         module)

Here is the call graph for this function:

Here is the caller graph for this function:

def unittest.loader.getTestCaseNames (   testCaseClass,
  prefix,
  sortUsing = util.three_way_cmp 
)

Definition at line 310 of file loader.py.

00310 
00311 def getTestCaseNames(testCaseClass, prefix, sortUsing=util.three_way_cmp):
00312     return _makeLoader(prefix, sortUsing).getTestCaseNames(testCaseClass)

Here is the call graph for this function:

def unittest.loader.makeSuite (   testCaseClass,
  prefix = 'test',
  sortUsing = util.three_way_cmp,
  suiteClass = suite.TestSuite 
)

Definition at line 314 of file loader.py.

00314 
00315               suiteClass=suite.TestSuite):
00316     return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase(
00317         testCaseClass)

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 14 of file loader.py.

Definition at line 299 of file loader.py.

tuple unittest.loader.VALID_MODULE_NAME = re.compile(r'[_a-z]\w*\.py$', re.IGNORECASE)

Definition at line 19 of file loader.py.