eric7.Testing.Interfaces.TestExecutorBase

Module implementing the executor base class for the various testing frameworks and supporting classes.

Global Attributes

None

Classes

TestConfig Class containing the test run configuration.
TestExecutorBase Base class for test framework specific implementations.
TestResult Class containing the test result data.
TestResultCategory Class defining the supported result categories.

Functions

None


TestConfig

Class containing the test run configuration.

Derived from

None

Class Attributes

None

Class Methods

None

Methods

None

Static Methods

None
Up


TestExecutorBase

Base class for test framework specific implementations.

Signals

collectError(list of tuple of (str, str)
) emitted when errors are encountered during test collection. Tuple elements are the test name and the error message.
collected(list of tuple of (str, str, str)
) emitted after all tests have been collected. Tuple elements are the test id, the test name and a short description of the test.
coverageDataSaved(str)
emitted after the coverage data was saved. The element is the absolute path of the coverage data file.
startTest(tuple of (str, str, str)
emitted before tests are run. Tuple elements are test id, test name and short description.
stop()
emitted when the test process is being stopped.
testFinished(list, str)
emitted when the test has finished. The elements are the list of test results and the captured output of the test worker (if any).
testResult(TestResult)
emitted when a test result is ready
testRunAboutToBeStarted()
emitted just before the test run will be started.
testRunFinished(int, float)
emitted when the test run has finished. The elements are the number of tests run and the duration in seconds

Derived from

QObject

Class Attributes

module
name
runner

Class Methods

isInstalled Class method to check whether a test framework is installed.

Methods

TestExecutorBase Constructor
_prepareProcess Protected method to prepare a process object to be started.
createArguments Public method to create the arguments needed to start the test process.
finished Public method handling the unit test process been finished.
getMarkers Public method to get the list of defined markers.
getVersions Public method to get the test framework version and version information of its installed plugins.
hasCoverage Public method to get the test framework version and version information of its installed plugins.
readAllOutput Public method to read all output of the test process.
start Public method to start the testing process.
stopIfRunning Public method to stop the testing process, if it is running.
supportsMarkers Public method to indicate the support for test filtering using markers and/or marker expressions.
supportsPatterns Public method to indicate the support for test filtering using test name patterns or a test name pattern expression.

Static Methods

None

TestExecutorBase.isInstalled (class method)

isInstalled(interpreter)

Class method to check whether a test framework is installed.

The test is performed by checking, if a module loader can found.

interpreter (str)
interpreter to be used for the test
Return:
flag indicating the test framework module is installed
Return Type:
bool

TestExecutorBase (Constructor)

TestExecutorBase(testWidget)

Constructor

testWidget (TestingWidget)
reference to the unit test widget

TestExecutorBase._prepareProcess

_prepareProcess(workDir, pythonpath)

Protected method to prepare a process object to be started.

workDir (str)
working directory
pythonpath (list of str)
list of directories to be added to the Python path
Return:
prepared process object
Return Type:
QProcess

TestExecutorBase.createArguments

createArguments(config)

Public method to create the arguments needed to start the test process.

config (TestConfig)
configuration for the test execution
Return:
list of process arguments
Return Type:
list of str
Raises NotImplementedError:
this method needs to be implemented by derived classes

TestExecutorBase.finished

finished()

Public method handling the unit test process been finished.

This method should read the results (if necessary) and emit the signal testFinished.

Raises NotImplementedError:
this method needs to be implemented by derived classes

TestExecutorBase.getMarkers

getMarkers(interpreter, workdir)

Public method to get the list of defined markers.

interpreter (str)
interpreter to be used for the test
workdir (str)
name of the working directory
Return:
dictionary containing the marker as key and the associated description as value
Return Type:
dict

TestExecutorBase.getVersions

getVersions(interpreter)

Public method to get the test framework version and version information of its installed plugins.

interpreter (str)
interpreter to be used for the test
Return:
dictionary containing the framework name and version and the list of available plugins with name and version each
Return Type:
dict

TestExecutorBase.hasCoverage

hasCoverage(interpreter)

Public method to get the test framework version and version information of its installed plugins.

interpreter (str)
interpreter to be used for the test
Return:
flag indicating the availability of coverage functionality
Return Type:
bool

TestExecutorBase.readAllOutput

readAllOutput(process=None)

Public method to read all output of the test process.

process (QProcess)
reference to the process object
Return:
test process output
Return Type:
str

TestExecutorBase.start

start(config, pythonpath)

Public method to start the testing process.

config (TestConfig)
configuration for the test execution
pythonpath (list of str)
list of directories to be added to the Python path
Raises RuntimeError:
raised if the the testing process did not start

TestExecutorBase.stopIfRunning

stopIfRunning()

Public method to stop the testing process, if it is running.

TestExecutorBase.supportsMarkers

supportsMarkers(interpreter)

Public method to indicate the support for test filtering using markers and/or marker expressions.

interpreter (str)
interpreter to be used for the test
Return:
flag indicating support of markers
Return Type:
bool

TestExecutorBase.supportsPatterns

supportsPatterns(interpreter)

Public method to indicate the support for test filtering using test name patterns or a test name pattern expression.

interpreter (str)
interpreter to be used for the test
Return:
flag indicating support of markers
Return Type:
bool
Up


TestResult

Class containing the test result data.

Derived from

None

Class Attributes

None

Class Methods

None

Methods

None

Static Methods

None
Up


TestResultCategory

Class defining the supported result categories.

Derived from

IntEnum

Class Attributes

FAIL
OK
PENDING
RUNNING
SKIP

Class Methods

None

Methods

None

Static Methods

None
Up