使用Python
2.7和更高版本,您无需编写新代码或使用第三方工具即可完成此操作。内置了通过命令行执行递归测试的功能。
__init__.py在您的测试目录中放置:
python -m unittest discover <test_directory># orpython -m unittest discover -s <directory> -p '*_test.py'
您可以在python 2.7 或python
3.x
unittest文档中阅读更多内容。

使用Python
2.7和更高版本,您无需编写新代码或使用第三方工具即可完成此操作。内置了通过命令行执行递归测试的功能。
__init__.py在您的测试目录中放置:
python -m unittest discover <test_directory># orpython -m unittest discover -s <directory> -p '*_test.py'
您可以在python 2.7 或python
3.x
unittest文档中阅读更多内容。