【发布时间】:2020-05-13 08:11:25
【问题描述】:
我正在尝试在 VSCode 测试资源管理器中运行 Django 单元测试,此外,我希望 CodeLens 的“运行测试”按钮出现在每个测试上方。 enter image description here 但是,在测试资源管理器中,当我按下播放按钮时,会显示错误: “没有进行任何测试”No Tests were Ran
我的目录结构是:
- 工作区_文件夹
- settings.json
- 回购
- python_module_1
- 子模块
- 测试
- test_a.py
- 测试
- 子模块
- python_module_1
我正在使用 unittest 框架。 我的 Settings.json 看起来像这样:
{
"python.pythonPath": "/Users/nbonilla/.local/share/virtualenvs/koku-iTLe243o/bin/python",
"python.testing.unittestArgs": [
"-v",
"-s",
"${workspaceFolder}/python_module_1/sub_module/"
],
"python.testing.pytestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.unittestEnabled": true,
}
当我按下绿色的“播放”按钮时Test Explorer Play Button Python 测试日志输出显示消息“启动的线程中未处理的异常” Unhandled Exception in thread started by 我正在使用 pipenv 虚拟环境。 如何在 VSCode 测试资源管理器中运行这些 Django 测试?
我看到使用 pyTest 是 unittest 的替代品,如何轻松设置它作为替代品?
【问题讨论】:
标签: django unit-testing visual-studio-code virtualenv pipenv