# eric7.Testing.Interfaces.PytestExecutor

Module implementing the executor for the 'pytest' framework.

### Global Attributes

None

### Classes

PytestExecutor | Class implementing the executor for the 'pytest' framework.

### Functions

None

## PytestExecutor

Class implementing the executor for the 'pytest' framework.

### Derived from

TestExecutorBase

### Class Attributes

module
name
runner

### Class Methods

None

### Methods

PytestExecutor | Constructor
__nodeid2testname | Private method to convert a nodeid to a test name.
__nodeid2testpath | Private method to convert a nodeid to a test path list.
__normalizeModuleName | Private method to convert a module name reported by pytest to Python conventions.
__processData | Private slot to process the received data.
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.
start | Public method to start the testing process.
startDebug | Public method to start the test run with debugger support.
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

#### PytestExecutor (Constructor)

PytestExecutor(testWidget)

Constructor

testWidget (TestingWidget)
  reference to the unit test widget

#### PytestExecutor.__nodeid2testname

__nodeid2testname(nodeid)

Private method to convert a nodeid to a test name.

nodeid (str)
  nodeid to be converted

Return:
  test name

Return Type:
  str

#### PytestExecutor.__nodeid2testpath

__nodeid2testpath(nodeid)

Private method to convert a nodeid to a test path list.

nodeid (str)
  nodeid to be converted

Return:
  test path list

Return Type:
  list of str

#### PytestExecutor.__normalizeModuleName

__normalizeModuleName(name)

Private method to convert a module name reported by pytest to Python conventions.

This method strips the extensions '.pyw' and '.py' first and replaces '/' and '\' thereafter.

name (str)
  module name reported by pytest

Return:
  module name iaw. Python conventions

Return Type:
  str

#### PytestExecutor.__processData

__processData(data)

Private slot to process the received data.

data (dict)
  data object received

#### PytestExecutor.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

#### PytestExecutor.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

#### PytestExecutor.finished

finished()

Public method handling the unit test process been finished.

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

#### PytestExecutor.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

#### PytestExecutor.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

#### PytestExecutor.hasCoverage

hasCoverage(interpreter)

Public method to check, if the collection of coverage data is available.

interpreter (str)
  interpreter to be used for the test

Return:
  flag indicating the availability of coverage functionality

Return Type:
  bool

#### PytestExecutor.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

#### PytestExecutor.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

#### PytestExecutor.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

#### PytestExecutor.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