JetBrains Fleet 1.30 Help

Python run configurations

This topic summarizes the run configurations available for Python. Each table provides keys that are available within a run configuration and their descriptions.

python

Runs Python scripts.

type

(required)

Specifies the configuration type

name

(required)

Specifies the configuration name displayed in the Run & Debug window

file

Either file or module is required

Specifies the path to the Python script to be executed

To execute a module, use module

module

Either module or file is required

Specifies the name of the module to be executed

To execute a Python script, use file

arguments

Specifies the arguments that will be passed to the script or module

environment

Custom environment variables for the process in the form of a JSON object. To define an environment variable, add a property, where the key is the variable name and the value is the value of the variable, for example:

"environment": { "PYTHONUNBUFFERED": "1", "PYTHONWARNINGS": "ignore" }

dependsOn

Names of other configurations which will be executed before this configuration, for example: "dependsOn": ["first", "second"]. For more information, refer to Chained run configurations.

workingDir

Working directory for this run configuration.

allowParallelRun

When set to true, more than one instance of this configuration can run in parallel.

Example

  • The following configuration runs script.py passing 60 as the argument:

    { "type": "python", "name": "run_script", "module": "script", "arguments": ["60"], }
Example of python configuration

python-tests

Runs Python tests by using either pytest or unittest testing framework.

type

(required)

Specifies the configuration type

name

(required)

Specifies the configuration name displayed in the Run & Debug window

testFramework

(required)

Specifies the testing framework. Possible values are:

  • pytest

  • unittest

targetType

Specifies the type of the targets parameter items. Possible values are:

  • module (default)

  • path

targets

(required)

Specifies the tests to be executed.

Depending on the value of targetType, the list can contain:

  • names of Python modules and test classes

  • paths to Python files and folders with tests

arguments

Lists the command-line options to be passed to the testing framework.

For the full list of available command-line options, refer to:

environment

Custom environment variables for the process in the form of a JSON object. To define an environment variable, add a property, where the key is the variable name and the value is the value of the variable, for example:

"environment": { "PYTHONUNBUFFERED": "1", "PYTHONWARNINGS": "ignore" }

dependsOn

Names of other configurations which will be executed before this configuration, for example: "dependsOn": ["first", "second"]. For more information, refer to Chained run configurations.

workingDir

Working directory for this run configuration.

allowParallelRun

When set to true, more than one instance of this configuration can run in parallel.

Examples

  • The following configuration uses pytest to run the tests in test_car.py and the tests directory. The -k not brake argument specifies that only the methods that don't contain "brake" in their names should be executed.

    { "type": "python-tests", "name": "pytest", "testFramework": "pytest", "targetType": "path", "targets": ["test_car.py", "tests"], "arguments": ["-k not brake"], }
    Example of pytest run configuration
  • The following configuration uses unittest to run the tests in tests/test_car.py. The --failfast argument specifies that the testing should be stopped on the first failure.

    { "type": "python-tests", "name": "unittest", "testFramework": "unittest", "targetType": "path", "targets": ["tests/test_car.py"], "arguments": ["--failfast"], }
    Example of pytest run configuration
Last modified: 21 February 2024