-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
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
- Create a virtual environment then
pip install -r requirements.dev.txt
- Edit
pyproject.toml
in the following ways:
Addtool.coverage.run.relative_files = true
to the top of the file.
Changetool.pytest.ini_options.addopts = "--doctest-modules"
totool.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
User Settings
languageServer: "Pylance"
testing
• pytestEnabled: true
experiments
• optInto: ["All"]
Installed Extensions
Extension Name | Extension Id | Version |
---|---|---|
.NET Install Tool | ms-dotnettools.vscode-dotnet-runtime | 2.1.7 |
Bash Beautify | shakram02.bash-beautify | 0.1.1 |
Bash Debug | rogalmic.bash-debug | 0.3.9 |
Bash IDE | mads-hartmann.bash-ide-vscode | 1.43.0 |
Better Jinja | samuelcolvin.jinjahtml | 0.20.0 |
C# | ms-dotnettools.csharp | 2.45.25 |
C# Dev Kit | ms-dotnettools.csdevkit | 1.10.18 |
CodeViz Stat | vizzuhq.code-viz-stat | 0.1.4 |
Coverage Gutters | ryanluker.vscode-coverage-gutters | 2.11.1 |
Cron Explained | tumido.cron-explained | 1.3.1 |
Crontab Syntax Highlight | hogashi.crontab-syntax-highlight | 0.0.2 |
CSharpier - Code formatter | csharpier.csharpier-vscode | 1.8.0 |
Cucumber (Gherkin) Full Support | alexkrechik.cucumberautocomplete | 3.0.5 |
Data Wrangler | ms-toolsai.datawrangler | 1.10.0 |
Dev Containers | ms-vscode-remote.remote-containers | 0.388.0 |
Docker | ms-azuretools.vscode-docker | 1.29.3 |
DotENV | mikestead.dotenv | 1.0.1 |
Error Lens | usernamehw.errorlens | 3.20.0 |
Even Better TOML | tamasfe.even-better-toml | 0.19.2 |
Excel Viewer | GrapeCity.gc-excelviewer | 4.2.62 |
File Downloader | mindaro-dev.file-downloader | 1.0.13 |
GitHub Actions | github.vscode-github-actions | 0.27.0 |
GitHub Copilot | GitHub.copilot | 1.235.0 |
GitHub Copilot Chat | GitHub.copilot-chat | 0.21.0 |
GitHub Pull Requests | GitHub.vscode-pull-request-github | 0.98.0 |
GitLens — Git supercharged | eamodio.gitlens | 15.5.1 |
Hex Editor | ms-vscode.hexeditor | 1.10.0 |
IntelliCode | VisualStudioExptTeam.vscodeintellicode | 1.3.1 |
IntelliCode for C# Dev Kit | ms-dotnettools.vscodeintellicode-csharp | 2.1.11 |
JavaScript Debugger | ms-vscode.js-debug | 1.94.0 |
JavaScript Debugger Companion Extension | ms-vscode.js-debug-companion | 1.1.3 |
Jira and Bitbucket (Atlassian Labs) | atlassian.atlascode | 3.0.10 |
json | ZainChen.json | 2.0.2 |
JSON Crack | AykutSarac.jsoncrack-vscode | 2.0.3 |
JSON Sample From Schema | roymudie.json-sample-from-schema | 0.0.6 |
Jupyter | ms-toolsai.jupyter | 2024.9.1 |
Jupyter Cell Tags | ms-toolsai.vscode-jupyter-cell-tags | 0.1.9 |
Jupyter Keymap | ms-toolsai.jupyter-keymap | 1.1.2 |
Jupyter Notebook Renderers | ms-toolsai.jupyter-renderers | 1.0.19 |
Jupyter Slide Show | ms-toolsai.vscode-jupyter-slideshow | 0.1.6 |
k6 for Visual Studio Code | k6.k6 | 0.6.0 |
Live Preview | ms-vscode.live-server | 0.4.15 |
markdownlint | DavidAnson.vscode-markdownlint | 0.56.0 |
Mustache | dawhite.mustache | 1.1.1 |
OpenAPI (Swagger) Editor | 42Crunch.vscode-openapi | 4.29.0 |
Path Intellisense | christian-kohler.path-intellisense | 2.9.0 |
Project Manager | alefragnani.project-manager | 12.8.0 |
Pylance | ms-python.vscode-pylance | 2024.9.2 |
Python | ms-python.python | 2024.16.0 |
Python Debugger | ms-python.debugpy | 2024.10.0 |
Rainbow CSV | mechatroner.rainbow-csv | 3.12.0 |
Remote - SSH | ms-vscode-remote.remote-ssh | 0.115.0 |
Remote - SSH: Editing Configuration Files | ms-vscode-remote.remote-ssh-edit | 0.87.0 |
Remote - Tunnels | ms-vscode.remote-server | 1.5.2 |
Remote Development | ms-vscode-remote.vscode-remote-extensionpack | 0.25.0 |
Remote Explorer | ms-vscode.remote-explorer | 0.4.3 |
REST Client | humao.rest-client | 0.25.1 |
Ruff | charliermarsh.ruff | 2024.50.0 |
shell-format | foxundermoon.shell-format | 7.2.5 |
ShellCheck | timonwong.shellcheck | 0.37.1 |
Sort Everything | bennycode.sort-everything | 1.4.1 |
Sort JSON objects | richie5um2.vscode-sort-json | 1.20.0 |
Spectral | stoplight.spectral | 1.1.2 |
SQLite Viewer | qwtel.sqlite-viewer | 0.7.3 |
Table Visualizer for JavaScript Profiles | ms-vscode.vscode-js-profile-table | 1.0.10 |
Task Explorer | spmeesseman.vscode-taskexplorer | 2.13.2 |
Todo Tree | Gruntfuggly.todo-tree | 0.0.226 |
VS Code Counter | uctakeoff.vscode-counter | 3.6.1 |
WSL | ms-vscode-remote.remote-wsl | 0.88.4 |
YAML | redhat.vscode-yaml | 1.15.0 |
System Info
Item | Value |
---|---|
CPUs | 12th Gen Intel(R) Core(TM) i7-12800H (20 x 2803) |
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.64GB (9.52GB free) |
Process Argv | . --crash-reporter-id c80b1e20-df75-4f9f-b510-9dec02122299 |
Screen Reader | no |
VM | 0% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
945dj816:31013170
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
impr_priority:31102340
nativerepl1:31139838
refactort:31108082
pythonrstrctxt:31112756
flighttreat:31134774
wkspc-onlycs-t:31132770
nativeloc2:31134642
wkspc-ranged-t:31151552
cf971741:31144450
autoexpandse:31146404
iacca1:31150322
notype1cf:31151524
5fd0e150:31146321