[英]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.