Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes
unittestgui.BaseGUITestRunner Class Reference

GUI framework classes. More...

Inheritance diagram for unittestgui.BaseGUITestRunner:
Inheritance graph
[legend]
Collaboration diagram for unittestgui.BaseGUITestRunner:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def errorDialog
def getDirectoryToDiscover
def runClicked
def stopClicked
def discoverClicked
def notifyTestsDiscovered
def notifyRunning
def notifyStopped
def notifyTestFailed
def notifyTestErrored
def notifyTestSkipped
def notifyTestFailedExpectedly
def notifyTestStarted
def notifyTestFinished

Public Attributes

 currentResult
 running
 test_suite
 directory_to_read
 top_level_dir
 test_file_glob_pattern
 totalTests
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Attributes

 __rollbackImporter

Detailed Description

GUI framework classes.

Subclass this class to create a GUI TestRunner that uses a specific
windowing toolkit. The class takes care of running tests in the correct
manner, and making callbacks to the derived class to obtain information
or signal that events have occurred.

Definition at line 49 of file unittestgui.py.


Constructor & Destructor Documentation

def unittestgui.BaseGUITestRunner.__init__ (   self,
  args,
  kwargs 
)

Definition at line 55 of file unittestgui.py.

00055 
00056     def __init__(self, *args, **kwargs):
00057         self.currentResult = None
00058         self.running = 0
00059         self.__rollbackImporter = None
00060         self.__rollbackImporter = RollbackImporter()
00061         self.test_suite = None
00062 
00063         #test discovery variables
00064         self.directory_to_read = ''
00065         self.top_level_dir = ''
00066         self.test_file_glob_pattern = 'test*.py'
00067 
00068         self.initGUI(*args, **kwargs)


Member Function Documentation

Definition at line 96 of file unittestgui.py.

00096 
00097     def discoverClicked(self):
00098         self.__rollbackImporter.rollbackImports()
00099         directory = self.getDirectoryToDiscover()
00100         if not directory:
00101             return
00102         self.directory_to_read = directory
00103         try:
00104             # Explicitly use 'None' value if no top level directory is
00105             # specified (indicated by empty string) as discover() explicitly
00106             # checks for a 'None' to determine if no tld has been specified
00107             top_level_dir = self.top_level_dir or None
00108             tests = unittest.defaultTestLoader.discover(directory, self.test_file_glob_pattern, top_level_dir)
00109             self.test_suite = tests
00110         except:
00111             exc_type, exc_value, exc_tb = sys.exc_info()
00112             traceback.print_exception(*sys.exc_info())
00113             self.errorDialog("Unable to run test '%s'" % directory,
00114                              "Error loading specified test: %s, %s" % (exc_type, exc_value))
00115             return
00116         self.notifyTestsDiscovered(self.test_suite)

Here is the call graph for this function:

def unittestgui.BaseGUITestRunner.errorDialog (   self,
  title,
  message 
)

Reimplemented in unittestgui.TkTestRunner.

Definition at line 69 of file unittestgui.py.

00069 
00070     def errorDialog(self, title, message):
00071         "Override to display an error arising from GUI usage"
00072         pass

Here is the caller graph for this function:

Reimplemented in unittestgui.TkTestRunner.

Definition at line 73 of file unittestgui.py.

00073 
00074     def getDirectoryToDiscover(self):
00075         "Override to prompt user for directory to perform test discovery"
00076         pass

Here is the caller graph for this function:

Reimplemented in unittestgui.TkTestRunner.

Definition at line 123 of file unittestgui.py.

00123 
00124     def notifyRunning(self):
00125         "Override to set GUI in 'running' mode, enabling 'stop' button etc."
00126         pass

Reimplemented in unittestgui.TkTestRunner.

Definition at line 127 of file unittestgui.py.

00127 
00128     def notifyStopped(self):
00129         "Override to set GUI in 'stopped' mode, enabling 'run' button etc."
00130         pass

def unittestgui.BaseGUITestRunner.notifyTestErrored (   self,
  test,
  err 
)

Reimplemented in unittestgui.TkTestRunner.

Definition at line 135 of file unittestgui.py.

00135 
00136     def notifyTestErrored(self, test, err):
00137         "Override to indicate that a test has just errored"
00138         pass

def unittestgui.BaseGUITestRunner.notifyTestFailed (   self,
  test,
  err 
)

Reimplemented in unittestgui.TkTestRunner.

Definition at line 131 of file unittestgui.py.

00131 
00132     def notifyTestFailed(self, test, err):
00133         "Override to indicate that a test has just failed"
00134         pass

Reimplemented in unittestgui.TkTestRunner.

Definition at line 143 of file unittestgui.py.

00143 
00144     def notifyTestFailedExpectedly(self, test, err):
00145         "Override to indicate that test has just failed expectedly"
00146         pass

Override to indicate that a test has finished (it may already have
   failed or errored)

Reimplemented in unittestgui.TkTestRunner.

Definition at line 151 of file unittestgui.py.

00151 
00152     def notifyTestFinished(self, test):
00153         """Override to indicate that a test has finished (it may already have
00154            failed or errored)"""
00155         pass
00156 

def unittestgui.BaseGUITestRunner.notifyTestsDiscovered (   self,
  test_suite 
)

Reimplemented in unittestgui.TkTestRunner.

Definition at line 119 of file unittestgui.py.

00119 
00120     def notifyTestsDiscovered(self, test_suite):
00121         "Override to display information about the suite of discovered tests"
00122         pass

Here is the caller graph for this function:

def unittestgui.BaseGUITestRunner.notifyTestSkipped (   self,
  test,
  reason 
)

Reimplemented in unittestgui.TkTestRunner.

Definition at line 139 of file unittestgui.py.

00139 
00140     def notifyTestSkipped(self, test, reason):
00141         "Override to indicate that test was skipped"
00142         pass

Reimplemented in unittestgui.TkTestRunner.

Definition at line 147 of file unittestgui.py.

00147 
00148     def notifyTestStarted(self, test):
00149         "Override to indicate that a test is about to run"
00150         pass

Definition at line 77 of file unittestgui.py.

00077 
00078     def runClicked(self):
00079         "To be called in response to user choosing to run a test"
00080         if self.running: return
00081         if not self.test_suite:
00082             self.errorDialog("Test Discovery", "You discover some tests first!")
00083             return
00084         self.currentResult = GUITestResult(self)
00085         self.totalTests = self.test_suite.countTestCases()
00086         self.running = 1
00087         self.notifyRunning()
00088         self.test_suite.run(self.currentResult)
00089         self.running = 0
00090         self.notifyStopped()

Here is the call graph for this function:

Definition at line 91 of file unittestgui.py.

00091 
00092     def stopClicked(self):
00093         "To be called in response to user stopping the running of a test"
00094         if self.currentResult:
00095             self.currentResult.stop()


Member Data Documentation

Definition at line 58 of file unittestgui.py.

Definition at line 56 of file unittestgui.py.

Definition at line 63 of file unittestgui.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 57 of file unittestgui.py.

Reimplemented in unittestgui.TkTestRunner.

Definition at line 65 of file unittestgui.py.

Definition at line 60 of file unittestgui.py.

Reimplemented in unittestgui.TkTestRunner.

Definition at line 64 of file unittestgui.py.

Definition at line 84 of file unittestgui.py.


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