eric7.Testing.Interfaces.TestExecutorBase
Module implementing the executor base class for the various testing frameworks
and supporting classes.
Global Attributes
Classes
Functions
TestConfig
Class containing the test run configuration.
Derived from
None
Class Attributes
collectCoverage |
coverageFile |
discover |
discoverOnly |
discoveryStart |
eraseCoverage |
failFast |
failedOnly |
interpreter |
testCases |
testFilename |
testMarkerExpression |
testName |
testNamePattern |
venvName |
Class Methods
Methods
Static Methods
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, str, int, list)
-
) emitted after
all tests have been collected. Tuple elements are the test id, the test name,
a short description of the test, the test file name, the line number of
the test and the elements of the test path as a list.
- coverageDataSaved(str)
-
emitted after the coverage data was saved.
The element is the absolute path of the coverage data file.
- discoveryAboutToBeStarted()
-
emitted just before the test discovery
will be started
- discoveryFinished(int, float)
-
emitted when the discovery has finished.
The elements are the number of discovered tests and the duration in seconds.
- 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
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. |
discover |
Public method to start the test discovery 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 check, if the collection of coverage data is available. |
readAllOutput |
Public method to read all output of the test process. |
start |
Public method to start the testing process. |
startDebug |
Public method to start the test run with debugger support. |
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
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.discover
discover(config, pythonpath)
Public method to start the test discovery process.
- config (TestConfig)
-
configuration for the test discovery
- pythonpath (list of str)
-
list of directories to be added to the Python path
- Raises RuntimeError:
-
raised if the the test discovery process did not start
- Raises ValueError:
-
raised if no start directory for the test discovery was
given
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.
TestExecutorBase.getMarkers
getMarkers(interpreter, workdir)
Public method to get the list of defined markers.
- interpreter (str)
-
interpreter to be used for the test (unused)
- 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 (unused)
- 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 check, if the collection of coverage data is available.
- interpreter (str)
-
interpreter to be used for the test (unused)
- 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.startDebug
startDebug(config, pythonpath, debugger)
Public method to start the test run with debugger support.
- config (TestConfig)
-
configuration for the test execution
- pythonpath (list of str)
-
list of directories to be added to the Python path
- debugger (DebugUI)
-
refference to the debugger interface
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 (unused)
- 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 (unused)
- Return:
-
flag indicating support of markers
- Return Type:
-
bool
TestResult
Class containing the test result data.
Derived from
None
Class Attributes
category |
description |
duration |
extra |
filename |
id |
lineno |
message |
name |
status |
subtestResult |
Class Methods
Methods
Static Methods
TestResultCategory
Class defining the supported result categories.
Derived from
IntEnum
Class Attributes
FAIL |
OK |
PENDING |
RUNNING |
SKIP |
Class Methods
Methods
Static Methods