最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin6PV0评论

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

Post a comment

comment list (0)

  1. No comments so far