PyCharm enables usage of the following testing frameworks:
Before you start working with the testing framework of your choice, make sure that:
- The desired framework is installed on your machine. Refer to the framework documentation for the installation details.
- The default test runner is selected (Settings | Python
Integrated Tools - Default test runner)
If the selected test runner is missing in the specified interpreter, the appropriate notification appears. Click the Fix button to download and install the corresponding framework.
With the test runner selected, PyCharm suggests the appropriate default run/debug configuration:
For each of the supported testing frameworks, PyCharm provides:
- Code completion, aware of the specific testing framework.
- Run/debug configurations.
- Possibility to create tests.
- Possibility to navigate between tests and test subjects.
- Possibility to run tests from within the IDE, and view test results in the test runner UI. The test results are shown on the Test Runner tab of the Run tool window.
- Possibility to run all tests in a directory, specific test classes, test cases, or individual test methods.
- In doctests:
- 2.7+PyCharm recognizes Python code, provides syntax highlighting, code completion and resolve, and Python inspections.
- 2.7.1+Possibility to recognize Python code can be turned on or off.
- 2.7+ If doctests are presented as separate files, PyCharm allows opening such files as reStructuredText files with *.rst extension. Such files are marked with icon, and feature syntax highlighting.
Refer to the section Testing for the detailed description of the common testing procedures.