Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
TestResult Class Reference

Test framework core. More...

Inheritance diagram for TestResult:
_TextTestResult

Public Member Functions

def __init__
 
def startTest
 
def stopTest
 
def addError
 
def addFailure
 
def addSuccess
 
def wasSuccessful
 
def stop
 
def __repr__
 

Data Fields

 failures
 
 errors
 
 testsRun
 
 shouldStop
 

Detailed Description

Test framework core.

Holder for test result information.

Test results are automatically managed by the TestCase and TestSuite
classes, and do not need to be explicitly manipulated by writers of tests.

Each instance holds the total number of tests run, and collections of
failures and errors that occurred among those test runs. The collections
contain tuples of (testcase, exceptioninfo), where exceptioninfo is the
formatted traceback of the error that occurred.

Definition at line 62 of file unittest.py.

Constructor & Destructor Documentation

def __init__ (   self)

Definition at line 73 of file unittest.py.

73 
74  def __init__(self):
75  self.failures = []
76  self.errors = []
77  self.testsRun = 0
78  self.shouldStop = 0

Member Function Documentation

def __repr__ (   self)

Definition at line 114 of file unittest.py.

References SymbolTable.__class__, TestResult.errors, StreamWriter.errors, ParsingError.errors, StreamReader.errors, StreamReaderWriter.errors, StreamRecoder.errors, TestResult.failures, and TestResult.testsRun.

115  def __repr__(self):
116  return "<%s run=%i errors=%i failures=%i>" % \
117  (self.__class__, self.testsRun, len(self.errors),
118  len(self.failures))
119 
def addError (   self,
  test,
  err 
)
Called when an error has occurred. 'err' is a tuple of values as
returned by sys.exc_info().

Definition at line 87 of file unittest.py.

87 
88  def addError(self, test, err):
89  """Called when an error has occurred. 'err' is a tuple of values as
90  returned by sys.exc_info().
91  """
92  self.errors.append((test, self._exc_info_to_string(err)))
def addFailure (   self,
  test,
  err 
)
Called when an error has occurred. 'err' is a tuple of values as
returned by sys.exc_info().

Definition at line 93 of file unittest.py.

References TestResult._exc_info_to_string().

93 
94  def addFailure(self, test, err):
95  """Called when an error has occurred. 'err' is a tuple of values as
96  returned by sys.exc_info()."""
97  self.failures.append((test, self._exc_info_to_string(err)))
def addSuccess (   self,
  test 
)

Definition at line 98 of file unittest.py.

98 
99  def addSuccess(self, test):
100  "Called when a test has completed successfully"
101  pass
def startTest (   self,
  test 
)

Definition at line 79 of file unittest.py.

References TestResult.testsRun.

79 
80  def startTest(self, test):
81  "Called when the given test is about to be run"
82  self.testsRun = self.testsRun + 1
def stop (   self)

Definition at line 106 of file unittest.py.

References string.join(), and TestResult.shouldStop.

107  def stop(self):
108  "Indicates that the tests should be aborted"
109  self.shouldStop = 1
def stopTest (   self,
  test 
)

Definition at line 83 of file unittest.py.

83 
84  def stopTest(self, test):
85  "Called when the given test has been run"
86  pass
def wasSuccessful (   self)

Definition at line 102 of file unittest.py.

103  def wasSuccessful(self):
104  "Tells whether or not this result was a success"
105  return len(self.failures) == len(self.errors) == 0

Field Documentation

errors

Definition at line 75 of file unittest.py.

failures

Definition at line 74 of file unittest.py.

shouldStop

Definition at line 77 of file unittest.py.

testsRun

Definition at line 76 of file unittest.py.


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