Choose your testing framework
Open the Settings/Preferences dialog (press Ctrl+Alt+S ), and under the node Tools, click the page Python Integrated Tools.
On this page, click the Default Test Runner field.
Choose the desired 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.
Change the default testing framework
From the main menu, selectfor Windows and Linux, or for macOS.
In the Testing area, select the test runner that will be default for all newly created projects.
With the test runner selected, PyCharm suggests the appropriate default run/debug configuration:
If a user already has the testing run/debug configuration for a specific file and for a specific testing framework, then PyCharm will launch this run/debug configuration, regardless of your chosen default test runner. For more details in how to change or delete such a configuration, see Create and edit run/debug configurations.
If a user opens any non-PyCharm project that involves testing frameworks, PyCharm will autodetect the required test runner and set it for the project.