[英]Python tests in more than one file in Visual Studio Code
我正在使用unittest
库使用 Visual Studio Code 为 Python/Django 应用程序运行一些测试。 他们工作得很好。 唯一的问题是我的测试位于多个文件中,我无法通过一次单击让 VS Code 运行所有测试,我必须单独运行每个文件。 我的结构是这样的:
/applications (folder)
/folder1
python_file_1.py
python_file_2.py
...
test_first.py
/folder2
python_file_3.py
python_file_4.py
...
test_second.py
test_third.py
这会在测试资源管理器中生成此树:
文件test_*.py
包含我的三组测试,但正如我所说,我一次只能运行它们。 如果我单击/applications
级别的play
按钮,VS Code 只会运行test_integration_comun.py
文件中的测试。 有没有办法只需单击一下即可运行所有 3 个?
这是我配置unittest
时 VS Code 添加的settings.json
文件:
{
"python.testing.unittestArgs": [
"-v",
"-s",
"./applications",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true
}
先谢谢您的帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.