python - The coverage run icon in the Test Explorer is not displayed in Visual Studio Code - Stack Overflow

The coverage run icon in the Test Explorer is not displayed in Visual Studio Code. Check snapshot. Is T

The coverage run icon in the Test Explorer is not displayed in Visual Studio Code. Check snapshot. Is There a way to enable coverage on Visual Code interface? I'm using Python pytest and working remotely on a Linux Ubuntu server using Remote-SSH extension. I'm attaching a snapshot of the Testing selection and the 'Settings.json' I have.

.

{
"python.analysis.autoImportCompletions": true,
"python.analysis.fixAll": ["source.unusedImports"],  
"editor.defaultFormatter": "charliermarsh.ruff",
"files.exclude": {
    "**/__pycache__": true,
    "**/.cache": true,
    "**/.coverage": true,
    "**/.coverage.*": true,
    "**/.hypothesis": true,
    "**/.mypy_cache": true,
    "**/.nox": true,
    "**/.pytest_cache": true,
    "**/.ruff_cache": true,
    "**/.tox": true
},
"python.testing.pytestEnabled": true

}

The coverage run icon in the Test Explorer is not displayed in Visual Studio Code. Check snapshot. Is There a way to enable coverage on Visual Code interface? I'm using Python pytest and working remotely on a Linux Ubuntu server using Remote-SSH extension. I'm attaching a snapshot of the Testing selection and the 'Settings.json' I have.

.

{
"python.analysis.autoImportCompletions": true,
"python.analysis.fixAll": ["source.unusedImports"],  
"editor.defaultFormatter": "charliermarsh.ruff",
"files.exclude": {
    "**/__pycache__": true,
    "**/.cache": true,
    "**/.coverage": true,
    "**/.coverage.*": true,
    "**/.hypothesis": true,
    "**/.mypy_cache": true,
    "**/.nox": true,
    "**/.pytest_cache": true,
    "**/.ruff_cache": true,
    "**/.tox": true
},
"python.testing.pytestEnabled": true

}

Share Improve this question asked Nov 16, 2024 at 14:06 MichaelMichael 578 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 1

Check whether pytest-cov is installed.

Add "python.experiments.optInto": ["pythonTestAdapter"] in user settings.json. After the plugin is installed, clear python project cache, restart the python extension.

Also check to update VS Code. I had this problem in an older version.

For your reference:

https://code.visualstudio/docs/python/testing#_run-tests-with-coverage

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745657712a4638643.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信