Type: Bug
Behaviour
Running tests with coverage ignores any coverage settings aside from ones the ones for the run.
I took a quick look and it is because the extension runs the tests with all the arguments, then in python_files/vscode_pytest/__init__.py, the coverage data gets loaded in a separate process without any of the arguments. So any arguments for report, or any plugins that configure them, get ignored.
Steps to reproduce:
- Add
exclude_lines = [] to coverage settings in or pyproject.toml. Now, any lines with # pragma: no cover should not be ignored.
- Add
# pragma: no cover to a line of code and run the tests with coverage. If you do this from a regular python script, you will get the line with pragma not excluded from coverage. However, the vscode extension does not do this and the line of code should still be included in the measurement.
Extension version: 2025.6.1
VS Code version: Code 1.100.2 (848b80aeb52026648a8ff9f7c45a9b0a80641e2e, 2025-05-14T21:47:40.416Z)
OS version: Windows_NT x64 10.0.19043
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.13.3
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
- Value of the
python.languageServer setting: Default
User Settings
languageServer: "Pylance"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Installed Extensions
| Extension Name |
Extension Id |
Version |
| a-file-icon-vscode |
ato |
2.0.1 |
| Bookmarks |
ale |
13.5.0 |
| change-case |
wma |
1.0.0 |
| color-highlight |
nau |
2.8.0 |
| copilot |
Git |
1.322.0 |
| copilot-chat |
Git |
0.27.1 |
| csv-to-table |
php |
1.4.1 |
| debugpy |
ms- |
2025.8.0 |
| dupchecker |
jia |
0.1.7 |
| even-better-toml |
tam |
0.21.2 |
| folder-path-color |
Vis |
0.0.15 |
| git-graph |
mhu |
1.30.0 |
| gokay-dark |
Gok |
0.0.16 |
| intellicode-api-usage-examples |
Vis |
0.2.9 |
| js-debug |
ms- |
1.100.1 |
| js-debug-companion |
ms- |
1.1.3 |
| jsonhero-vscode |
JSO |
0.1.4 |
| one-hunter |
Rai |
1.4.0 |
| python |
ms- |
2025.6.1 |
| rainbow-csv |
mec |
3.19.0 |
| ruff |
cha |
2025.22.0 |
| semanticdiff |
sem |
0.10.0 |
| shellcheck |
tim |
0.37.7 |
| sourcery |
sou |
1.36.0 |
| tensorboard |
ms- |
2023.10.1002992421 |
| vscode-github-actions |
git |
0.27.1 |
| vscode-icons |
vsc |
12.13.0 |
| vscode-js-profile-table |
ms- |
1.0.10 |
| vscode-markdownlint |
Dav |
0.59.0 |
| vscode-peacock |
joh |
4.2.2 |
| vscode-pylance |
ms- |
2025.5.1 |
| vscode-theme |
Gok |
0.0.1 |
| vscode-yaml |
red |
1.18.0 |
| vscodeintellicode |
Vis |
1.3.2 |
System Info
| Item |
Value |
| CPUs |
11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz (16 x 2496) |
| GPU Status |
2d_canvas: enabled canvas_oop_rasterization: enabled_on direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) |
undefined |
| Memory (System) |
31.71GB (11.02GB free) |
| Process Argv |
|
| Screen Reader |
no |
| VM |
0% |
Type: Bug
Behaviour
Running tests with
coverageignores anycoveragesettings aside from ones the ones for the run.I took a quick look and it is because the extension runs the tests with all the arguments, then in
python_files/vscode_pytest/__init__.py, the coverage data gets loaded in a separate process without any of the arguments. So any arguments for report, or any plugins that configure them, get ignored.Steps to reproduce:
exclude_lines = []to coverage settings in orpyproject.toml. Now, any lines with# pragma: no covershould not be ignored.# pragma: no coverto a line of code and run the tests with coverage. If you do this from a regular python script, you will get the line with pragma not excluded from coverage. However, the vscode extension does not do this and the line of code should still be included in the measurement.Extension version: 2025.6.1
VS Code version: Code 1.100.2 (848b80aeb52026648a8ff9f7c45a9b0a80641e2e, 2025-05-14T21:47:40.416Z)
OS version: Windows_NT x64 10.0.19043
Modes:
python.languageServersetting: DefaultUser Settings
Installed Extensions
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off