# eric3.PyUnit.UnittestDialog

Module implementing the UI to the pyunit package.

### Classes

QtTestResult | A TestResult derivative to work with a graphical GUI.
UnittestDialog | Class implementing the UI to the pyunit package.

### Functions

None

## QtTestResult

A TestResult derivative to work with a graphical GUI. For more details see pyunit.py of the standard python distribution.

### Derived from

unittest.TestResult

### Methods

QtTestResult | Constructor
addError | Method called if a test errored.
addFailure | Method called if a test failed.
startTest | Method called at the start of a test.
stopTest | Method called at the end of a test.

### QtTestResult (Constructor)

QtTestResult(parent)

Constructor

parent
  The parent widget.

### QtTestResult.addError

addError(test, err)

Method called if a test errored.

test
  Reference to the test object
err
  The error traceback

### QtTestResult.addFailure

addFailure(test, err)

Method called if a test failed.

test
  Reference to the test object
err
  The error traceback

### QtTestResult.startTest

startTest(test)

Method called at the start of a test.

test
  Reference to the test object

### QtTestResult.stopTest

stopTest(test)

Method called at the end of a test.

test
  Reference to the test object

Up

## UnittestDialog

Class implementing the UI to the pyunit package.

#### Signals

unittestFile(string,int,int)
  emitted to show the source of a unittest file

### Derived from

UnittestForm

### Methods

UnittestDialog | Constructor
colorizeProgressbar | Private methode to set the color of the progressbar.
handleErrorHighlighted | Private slot to handle the highlighted(const QString&) signal.
handleFileDialog | Private slot to open a file dialog.
handleListboxDoubleClick | Private slot called by doubleclicking an errorlist entry.
handleRunning | Private method to set the GUI in running mode.
handleShowSource | Private slot to show the source of a traceback in an eric3 editor.
handleStartTest | Public slot to start the test.
handleStopTest | Private slot to stop the test.
handleStopped | Private method to set the GUI in stopped mode.
handleTestErrored | Public method called if a test errors.
handleTestFailed | Public method called if a test fails.
handleTestFinished | Public method called if a test has finished.
handleTestStarted | Public method called if a test is about to be run.
handleUTPrepared | Private slot to handle the utPrepared signal.
insertProg | Public slot to insert the filename prog into the testsuiteComboBox object.

### UnittestDialog (Constructor)

UnittestDialog(prog = None, dbs = None, ui = None, parent = None, name = None, fl = 0)

Constructor

prog
  filename of the program to open
dbs
  reference to the debug server object. It is an indication whether we were called from within the eric3 IDE
ui
  reference to the UI object
parent
  parent widget of this dialog (QWidget)
name
  name of this dialog (string or QString)
modal
  flag indicating a modal dialog
fl
  window flags

### UnittestDialog.colorizeProgressbar

colorizeProgressbar(color)

Private methode to set the color of the progressbar.

color
  colour for the progressbar

### UnittestDialog.handleErrorHighlighted

handleErrorHighlighted(text)

Private slot to handle the highlighted(const QString&) signal.

### UnittestDialog.handleFileDialog

handleFileDialog()

Private slot to open a file dialog.

### UnittestDialog.handleListboxDoubleClick

handleListboxDoubleClick(lbitem)

Private slot called by doubleclicking an errorlist entry. It will popup a dialog showing the stacktrace. If called from eric, an additional button is displayed to show the python source in an eric source viewer (in erics main window.

lbitem
  the listbox item that was double clicked

### UnittestDialog.handleRunning

handleRunning()

Private method to set the GUI in running mode.

### UnittestDialog.handleShowSource

handleShowSource()

Private slot to show the source of a traceback in an eric3 editor.

### UnittestDialog.handleStartTest

handleStartTest()

Public slot to start the test.

### UnittestDialog.handleStopTest

handleStopTest()

Private slot to stop the test.

### UnittestDialog.handleStopped

handleStopped()

Private method to set the GUI in stopped mode.

### UnittestDialog.handleTestErrored

handleTestErrored(test, exc)

Public method called if a test errors.

test
  name of the failed test (string)
exc
  string representation of the exception (list of strings)

### UnittestDialog.handleTestFailed

handleTestFailed(test, exc)

Public method called if a test fails.

test
  name of the failed test (string)
exc
  string representation of the exception (list of strings)

### UnittestDialog.handleTestFinished

handleTestFinished()

Public method called if a test has finished. Note: It is also called if it has already failed or errored.

### UnittestDialog.handleTestStarted

handleTestStarted(test, doc)

Public method called if a test is about to be run.

test
  name of the started test (string)
doc
  documentation of the started test (string)

### UnittestDialog.handleUTPrepared

handleUTPrepared(nrTests, exc_type, exc_value)

Private slot to handle the utPrepared signal. If the unittest suite was loaded successfully, we ask the client to run the test suite.

nrTests
  number of tests contained in the test suite (integer)
exc_type
  type of exception occured during preparation (string)
exc_value
  value of exception occured during preparation (string)

### UnittestDialog.insertProg

insertProg(prog)

Public slot to insert the filename prog into the testsuiteComboBox object.

prog
  filename to be inserted /string or QString)

Up