VSCode 设置 Python 的 unittest 测试
设置 VSCode 的 Testing

点击 VSCode 左侧的 Testing,进入 Configure Python Tests 模块。

在弹出框中选择 unittest,后会让你选择测试代码的文件夹。

这里按照真是文件夹选择,一般我们会将测试代码放在项目根目录下的 test 文件夹

下一步就是按照你们命名规范选择测试代代码文件的命名方式了,我们是采用 test_*.py 模式定义的,因此我们选择该类型就完成了配置了。

我们再点击上面的执行 case 的按钮,就可以完成测试了。
版权声明: 本文为 InfoQ 作者【陈磊@Criss】的原创文章。
原文链接:【http://xie.infoq.cn/article/9e427cf44436eab993e513063】。
本文遵守【CC BY-SA】协议,转载请保留原文出处及本版权声明。
评论