[] Using Python + unittest test suite TestSuite add only one use case, but performed all use cases, turned out to be PyCharm configuration issues

Today in learning TestSuite test suite, a total of three test cases, the test suite TestSuite added only one, but the implementation of all three use cases.

Degree of your mother find out the reasons, turned out to be a configuration problem PyCharm.

pycharm把代码识别成了测试代码,所以没有执行if __name__ =='__main__':之后的代码。

1. Open: Run Run -> Edit configurations Structure Edit -> New Python + 1 arranged on it. (Do not Python tests)

  

2.Script add the path. Do not add directly to "OK", it should be also possible.

3. Re-run, should be on it. (Execution, you can see here, are not you just add configuration)

 

Published 63 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/woshiyigerenlaide/article/details/104116448