Back to index

salome-kernel  6.5.0
Public Member Functions | Private Attributes
KERNEL_PY.kernel.pyunittester.PyUnitTester Class Reference

List of all members.

Public Member Functions

def __init__
def addTestCase
def setLogFilename
def run
def printreport

Private Attributes


Detailed Description

This class is a simple wrapper of the pyunit framework.

Definition at line 39 of file

Constructor & Destructor Documentation

Definition at line 43 of file

00044     def __init__(self):
00045         self.__listTestSuite=[]
00046         self.setLogFilename("testlog.txt")

Member Function Documentation

def KERNEL_PY.kernel.pyunittester.PyUnitTester.addTestCase (   self,

Definition at line 47 of file

00048     def addTestCase(self,testCaseClass):
00049         # We test some attributes to validate that the argument
00050         # corresponds to a unittest.TestCase class (WARN: it's not an
00051         # instance but a class keyword)
00052         if "assertTrue" not in dir(testCaseClass):
00053             raise DevelException("Not a pyunit test case")
00055         suite = unittest.TestLoader().loadTestsFromTestCase(testCaseClass)
00056         self.__listTestSuite.append(suite)

Here is the call graph for this function:

Definition at line 75 of file

00076     def printreport(self):
00077         printfile(self.__logfilename)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 60 of file

00061     def run(self):
00062         # We first open the output stream
00063         if os.path.exists(self.__logfilename):
00064             os.remove(self.__logfilename)
00065         logfile = open(self.__logfilename,'w')
00067         # Then, define and execute the runner to play the test suites
00068         runner = unittest.TextTestRunner(stream=logfile,verbosity=2)
00069         for suite in self.__listTestSuite:
00072         # Finally close the ouput stream and print the report
00073         logfile.close()
00074         self.printreport()

Here is the call graph for this function:

Definition at line 57 of file

00058     def setLogFilename(self, filename):
00059         self.__logfilename = filename

Member Data Documentation

Definition at line 44 of file

Definition at line 58 of file

The documentation for this class was generated from the following file: