The new version of pycharm2022, when debugging the program, cannot enter __main__, and finally found that the debug mode is pytest. The main reason is that there is a function named test.
1. Problems
When right-clicking to run the code, it is inconsistent with normal operation, and only executes a single function test.
The following screen appears in the right-click menu: " Debug 'Python test for' "
![](https://img-blog.csdnimg.cn/cff4213da8b34f879c67a1ca19c268f5.png)
2. Solution 1
Go to the File->Settings->Tools->Python integrated Tools interface, and set Autodetect(pytest) to Unittests to solve this problem.
![](https://img-blog.csdnimg.cn/661b19ddd69244d4bfeb79be6c64a6e2.png)
3. Solution 2
You can directly modify the function name without starting with test. For example, the author here can solve this problem by changing the function name to little_test.
Because there is a test function in the example of the book I read.