You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python code coverage is partially broken when "relative paths" is used for coverage.
Specifically: the code coverage percentages are shown in the Testing view, but the paths to the files are incorrect, and the gutters of the files do not show coverage information.
Repro Steps
git clone https://github.com/psf/requests.git
Create a virtual environment then pip install -r requirements.dev.txt
Edit pyproject.toml in the following ways:
Add tool.coverage.run.relative_files = true to the top of the file.
Change tool.pytest.ini_options.addopts = "--doctest-modules" to tool.pytest.ini_options.addopts = "--cov-config=pyproject.toml"
Go to "Testing".
If applicable, set configure testing for pytest.
Don't run the full test suite, just select a single random test and get coverage information for that.
"test coverage" should pop up, hover over any file and you should note that the path is invalid (in Windows). An example of a path: \src\requests\__init__.py. When things are working correctly, you get an absolute path including the drive letter.
Also, if you click on any of the files, VSCode will pop a modal saying that the file could not be found.
The steps above use requests because it was easy to find and clone. The only real requirement to reproduce the issue is to ensure that relative_files is enabled in coverage.
Note that the path provided in the tooltip begins with a backslash.
Extension version: 2024.16.0
VS Code version: Code 1.94.0 (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Python version (& distribution if applicable, e.g. Anaconda): 3.12.6
Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
Value of the python.languageServer setting: Default
Type: Bug
Behaviour
Python code coverage is partially broken when "relative paths" is used for coverage.
Specifically: the code coverage percentages are shown in the Testing view, but the paths to the files are incorrect, and the gutters of the files do not show coverage information.
Repro Steps
git clone https://github.com/psf/requests.git
pip install -r requirements.dev.txt
pyproject.toml
in the following ways:Add
tool.coverage.run.relative_files = true
to the top of the file.Change
tool.pytest.ini_options.addopts = "--doctest-modules"
totool.pytest.ini_options.addopts = "--cov-config=pyproject.toml"
If applicable, set configure testing for pytest.
"test coverage" should pop up, hover over any file and you should note that the path is invalid (in Windows). An example of a path:
\src\requests\__init__.py
. When things are working correctly, you get an absolute path including the drive letter.Also, if you click on any of the files, VSCode will pop a modal saying that the file could not be found.
The steps above use
requests
because it was easy to find and clone. The only real requirement to reproduce the issue is to ensure thatrelative_files
is enabled in coverage.Note that the path provided in the tooltip begins with a backslash.
Extension version: 2024.16.0
VS Code version: Code 1.94.0 (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z)
OS version: Windows_NT x64 10.0.19045
Modes:
python.languageServer
setting: 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
A/B Experiments
The text was updated successfully, but these errors were encountered: