PyCharm 2017.1 Help

Creating Run/Debug Configuration for Tests

On this page:


You can run your tests (test cases, test suites, etc.) using run/debug configurations, in the way similar to running ordinary applications. PyCharm provides a framework for creating special run/debug configurations for testing purposes, where a test can be specified as a target.

In addition to the regular procedure described in the section Creating and Editing Run/Debug Configuration, PyCharm provides a shortcut that allows you to create run/debug configurations for all tests in a container, for a single test case, or even for a test method.

Creating a test configuration

To create a test configuration

  1. Right-click the desired target, for example a directory or an individual test in the Project tool window. In case of an individual test, you can open it in the editor, and right-click the background.
  2. On the context menu of the selection, choose Create <name> for an individual test . For your convenience, the corresponding context menu commands are marked with icons:
    • /help/img/idea/2017.1/py_unitTestIcon.png for Python unittest
    • /help/img/idea/2017.1/py_unitTestIcon.png for Python doctests
    • /help/img/idea/2017.1/py_unitTestIcon.png for Python nosetest
    • /help/img/idea/2017.1/py_djangoTestIcon.png for Django unit tests
    • /help/img/idea/2017.1/py_testIcon.png for py.test framework
  3. In the dialog box that opens, specify the run/debug configuration parameters, apply changes and close the dialog.

    Ctrl+Space code completion works in run/debug configuration dialog boxes, for example in the Working directory field.


See Also

Last modified: 25 March 2017