CLion 2026.1 Help

Pytest

Create: Run | Edit Configurations | Add New Configuration | Python Tests | pytest

Use this dialog to create a run/debug configuration for pytests.

Toolbar

The tree view of run/debug configurations has a toolbar that helps you manage configurations available in your project as well as adjust default configurations templates.

Item

Shortcut

Description

the Add button

Alt+Insert

Create a run/debug configuration.

the Remove button

Alt+Delete

Delete the selected run/debug configuration. Note that you cannot delete default configurations.

Copy

Ctrl+D

Create a copy of the selected run/debug configuration. Note that you create copies of default configurations.

Save configuration

The button is displayed only when you select a temporary configuration. Click this button to save a temporary configuration as permanent.

Move into new folder / Create new folder

Move into new folder / Create new folder. You can group run/debug configurations by placing them into folders.

To create a folder, select the configurations within a category, click Folder, and specify the folder name. If only a category is in focus, an empty folder is created.

Then, to move a configuration into a folder, between the folders or out of a folder, use drag or Move Up and Move Down buttons.

To remove grouping, select a folder and click Remove Configuration.

Sort configurations

Click this button to sort configurations in the alphabetical order.

Common options

Item

Description

Name

Specify a name for the run configuration to quickly identify it among others when editing or running.

Store as project file

Save the file with the run configuration settings to share it with other team members. The default location is .idea/runConfigurations. However, if you do not want to share the .idea directory, you can save the configuration to any other directory within the project.

By default, it is disabled, and CLion stores run configuration settings in .idea/workspace.xml.

Pytest-specific onfiguration options

Item

Description

Python Interpreter

Select one of the pre-configured Python interpreters.

Target: script/module/custom

Select the target from the drop-down:

  • script: a path to a Python file.

  • module: a Python module name and a test class instance.

  • custom: an arbitrary combination of paths, modules, and test class instances.

Depending on the selected target type, you can specify the following values:

  • Path to the test file, for example, /Users/jetbrains/Car/my_tests/test_car.py. You can type in the path or click the Browse button to locate the file in the project structure.

  • Name of the module in your project, for example, my_tests. You can type in the module name, search the target module by its name, or locate it in the project structure.

  • Custom combination of modules, scripts, classes, and methods, for example, my_tests.test_car.TestCar.test_brake, where:

    • my_tests: the package name

    • test_car: the module name

    • TestCar: the class instance in test_car

    • test_brake: the method in the TestCar class

Additional Arguments

In this text field, specify the additional framework-specific arguments to be passed to the test as-is, for example:

--some-argument=some-value

Keywords

An expression to match on the test names. See examples on docs.pytest.org.

Environment variables

Click the browse button, or press Shift+Enter to specify the desired set of environment variables in the Environment Variables dialog. To create a new variable, click , and type the desired name and value.

Docker container settings

Click the Browse button to open the dialog and specify the following settings:

Options

  • Disable networking: select this checkbox to have the networking disabled. This corresponds to --net="none", which means that inside a container the external network resources are not available.

  • Network mode: corresponds to the other values of the option --net.

    • bridge is the default value. An IP address will be allocated for container on the bridge’s network and traffic will be routed through this bridge to the container.

      Containers can communicate via their IP addresses by default. To communicate by name, they must be linked.

    • host: use the host's network stack inside the container.

    • container:<name|id>: use the network stack of another container, specified via its name or id.

    For more information, refer to the Network settings documentation.

  • Links: Use this section to link the container to be created with the other containers. This is applicable to Network mode = bridge and corresponds to the --link option.

  • Publish all ports: Expose all container ports to the host. This corresponds to the option --publish-all.

  • Port bindings: Specify the list of port bindings. Similar to using the -p option with docker run.

  • Extra hosts: This corresponds to the --add-host option. For more information, refer to Managing /etc/hosts.

  • Volume bindings: Use this field to specify the bindings between the special folders-volumes and the folders of the computer, where the Docker daemon runs. This corresponds to the -v option. For more information, refer to Managing data in containers.

  • Environment variables: Use this field to specify the list of environment variables and their values. This corresponds to the -e option. For more information, refer to ENV (environment variables).

Click to expand the tables. Click , , or to make up the lists.

Additional options

Click Modify options and select the options that you want to add to the dialog.

Operating System

Item

Description

Allow multiple instances

Allow running multiple instances of this run configuration in parallel.

By default, it is disabled, and when you start this configuration while another instance is still running, CLion suggests stopping the running instance and starting another one. This is helpful when a run configuration consumes a lot of resources and there is no good reason to run multiple instances.

Python

Item

Description

Interpreter options

In this field, specify the command-line options to be passed to the interpreter. If necessary, click Expand the field, and type the string in the editor.

Add content roots to PYTHONPATH

Select this checkbox to add all content roots of your project to the environment variable PYTHONPATH.

Add source roots to PYTHONPATH

Select this checkbox to add all source roots of your project to the environment variable PYTHONPATH.

Debug

Item

Description

Debug just my code

When this option is enabled, the debugger focuses only on user-written code and skips stepping into external libraries.

Logs

The following options are related to logging the execution of this configuration. For more information, refer to .

Item

Description

Specify logs to be shown in the console

Specify which log files to display while running the application.

Click the Add button to add a new log. In the Edit Log Files Aliases dialog, configure the following:

  • Alias: The name of the tab where the log will be displayed.

  • Log File Location: Specify the path to the log file or an Ant pattern. If several files of a rolling log match the pattern, CLion will display the most recent one.

  • Show all files coverable by pattern: Show all logs that match the pattern.

For logs in the table, you can configure the following options:

  • Is Active: Display the specified log file.

  • Skip Content: Do not display old log messages from previous runs.

Save console output to file

Save the console output to the specified location. Type the path manually or click the browse button and point to the desired location in the dialog that opens.

Show console when a message is printed to stdout

Activate the console when the application writes to the standard output stream.

Show console when a message is printed to stderr

Activate the console when the application writes to the standard error stream.

Before launch

Item

Description

Open run/debug tool window when started

By default this option is selected and the Run or the Debug tool window opens when you start the run/debug configuration.

Otherwise, the tool window is hidden. However, when the configuration is running, you can open the corresponding tool window for it yourself by pressing Alt+4 or Alt+5.

Focus run/debug tool window when started

Select this option to automatically move focus to the Run or the Debug tool window when you start the run/debug configuration.

Show the run/debug configuration settings before start

Select this option to show the run/debug configuration settings prior to actually starting the run/debug configuration.

Add before launch task

Select this option to add one of the following available tasks:

  • Run External tool: select to run an external application. In the dialog that opens, select one or multiple applications you want to run. If it is not defined in CLion yet, add its definition. For more information, refer to External tools and External Tools.

  • Run Another Configuration: select to execute another run/debug configuration and wait until it finishes before starting the current configuration. If you want to run several configurations in parallel, use a compound run/debug configuration.

  • Run File Watchers: select this option to have CLion apply all the currently active File Watchers.

  • Run Grunt task: select this option to run a Grunt task.

    In the Grunt task dialog that opens, specify the Gruntfile.js where the required task is defined, select the task to execute, and specify the arguments to pass to the Grunt tool.

    Specify the location of the Node.js runtime, the parameters to pass to it, and the path to the grunt-cli package.

  • Run gulp task: select this option to run a Gulp task.

    In the Gulp task dialog that opens, specify the Gulpfile.js where the required task is defined, select the task to execute, and specify the arguments to pass to the Gulp tool.

    Specify the location of the Node.js runtime, the parameters to pass to it, and the path to the gulp package.

  • Run npm script: select this option to execute an npm script.

    In the NPM Script dialog that opens, specify the npm run/debug configuration settings.

  • Compile TypeScript: select to run the built-in TypeScript compiler and thus make sure that all the changes you made to your TypeScript code are reflected in the generated JavaScript files. In the TypeScript Compile Settings dialog that opens, select or clear the Check errors checkbox to configure the behaviour of the compiler in case any errors are detected:

    • If the Check errors checkbox is selected, the compiler will show all the errors and the run configuration will not start.

    • If the Check errors checkbox is cleared, the compiler will show all the detected errors but the run configuration still will be launched.

  • Generate CoffeeScript Source Maps: select this option to generate the source maps for your CoffeeScript sources. In the dialog that opens, specify where your CoffeeScript source files are located.

04 March 2026