Module EDTest
[hide private]
[frames] | no frames]

Source Code for Module EDTest

  1  # coding: utf8 
  2  # 
  3  #    Project: The EDNA Kernel 
  4  #             http://www.edna-site.org 
  5  # 
  6  #    Copyright (C) 2008-2012 European Synchrotron Radiation Facility 
  7  #                            Grenoble, France 
  8  # 
  9  #    Principal authors: Olof Svensson (svensson@esrf.fr) 
 10  #                       Jérôme Kieffer (jerome.kieffer@esrf.fr) 
 11  # 
 12  #    This program is free software: you can redistribute it and/or modify 
 13  #    it under the terms of the GNU Lesser General Public License as published 
 14  #    by the Free Software Foundation, either version 3 of the License, or 
 15  #    (at your option) any later version. 
 16  # 
 17  #    This program is distributed in the hope that it will be useful, 
 18  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
 19  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 20  #    GNU Lesser General Public License for more details. 
 21  # 
 22  #    You should have received a copy of the GNU General Public License 
 23  #    and the GNU Lesser General Public License  along with this program.   
 24  #    If not, see <http://www.gnu.org/licenses/>. 
 25  # 
 26   
 27  # 
 28  # This class has been inspired by the corresponding AALib class  
 29  # (20090518-PyAALib-JyAALib-111) and modified according to the needs  
 30  # for the EDNA project. 
 31  # 
 32   
 33  """ 
 34  EDNA Test class, Parent class for all plugin test cases 
 35  """ 
 36   
 37  __authors__ = "Olof Svensson, Jerome Kieffer" 
 38  __contact__ = "svensson@esrf.eu" 
 39  __license__ = "LGPLv3+" 
 40  __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" 
 41  __date__ = "20120711" 
 42   
 43  from EDObject          import  EDObject 
 44  from EDLogging         import  EDLogging 
 45   
 46   
47 -class EDTest(EDLogging):
48 """ 49 Parent class for plugin test cases 50 """
51 - def __init__(self, _strTestName="Test"):
52 EDLogging.__init__(self) 53 if _strTestName is None: 54 self.__strTestName = self.getClassName() 55 else: 56 self.__strTestName = _strTestName 57 self.__listTest = [] 58 self.__bIsVerbose = False 59 self.__bIsDebug = False 60 self.__bIsAssert = False 61 self.__bIsLogFile = False 62 self.__bIsProfile = False
63 64
65 - def getTestName(self):
66 """ 67 getter for TestName 68 @return: test name 69 @rtype: string 70 """ 71 return self.__strTestName
72 73
74 - def setTestName(self, _strTestName):
75 """ 76 Setter for test name 77 @param _strTestName: name of the test 78 @type _strTestName: string 79 """ 80 self.__strTestName = _strTestName
81
82 - def addTestMethod(self, _pyClassMethod):
83 """ 84 Add a method to the list of tests 85 """ 86 self.__listTest.append(_pyClassMethod)
87 88
89 - def getNumberOfTests(self):
90 """ 91 getter for the number of tests 92 @rtype: integer 93 @return: number of tests 94 """ 95 return len(self.__listTest)
96 97
98 - def getListTest(self):
99 """ 100 getter for the list of tests 101 @rtype: list 102 @return: list of tests 103 """ 104 return self.__listTest
105 106
107 - def executeKernel(self):
108 self.DEBUG("EDTest.executeKernel") 109 self.preProcess() 110 self.process() 111 self.processKernel() 112 self.postProcess()
113 114
115 - def execute(self):
116 self.DEBUG("EDTest.execute()") 117 self.executeKernel()
118 119
120 - def preProcess(self):
121 """ 122 to be overwritten 123 """ 124 self.DEBUG("EDTest.preProcess()")
125 126
127 - def process(self):
128 """ 129 to be overridden 130 """ 131 self.DEBUG("EDTest.process()")
132 133
134 - def postProcess(self):
135 """ 136 to be overridden 137 """ 138 self.DEBUG("EDTest.postProcess()")
139 140
141 - def processKernel(self):
142 """ 143 to be overridden 144 """ 145 self.DEBUG("EDTest.processKernel()")
146