admin管理员组

文章数量:1026989

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

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

本文标签: pythonThe coverage run icon in the Test Explorer is not displayed in Visual Studio CodeStack Overflow