Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage percentages don't match in the UI and in the coverage.py output #24243

Closed
AlexanderPodorov opened this issue Oct 4, 2024 · 4 comments
Assignees
Labels
area-testing triage-needed Needs assignment to the proper sub-team

Comments

@AlexanderPodorov
Copy link

Type: Bug

Behaviour

Coverage percentages don't match in the UI and in the coverage.py output. For both "missing lines" and "branch" coverage. See attached screenshot.

Steps to reproduce:

???

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

---

Extension version: 2024.17.2024100401
VS Code version: Code 1.94.0 (Universal) (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z)
OS version: Darwin arm64 22.1.0
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.5
  • 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
Even Better TOML tamasfe.even-better-toml 0.19.2
JavaScript Debugger ms-vscode.js-debug 1.94.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
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
Live Preview ms-vscode.live-server 0.4.15
Markdown All in One yzhang.markdown-all-in-one 3.6.2
Markdown Emoji bierner.markdown-emoji 0.3.0
Markdown Preview Mermaid Support bierner.markdown-mermaid 1.25.0
Pylance ms-python.vscode-pylance 2024.8.2
Python ms-python.python 2024.17.2024100401
Python Debugger ms-python.debugpy 2024.10.0
Ruff charliermarsh.ruff 2024.50.0
Sort lines Tyriar.sort-lines 1.11.0
SQLTools mtxr.sqltools 0.28.3
SQLTools PostgreSQL/Cockroach Driver mtxr.sqltools-driver-pg 0.5.4
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.10
System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
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
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.49GB free)
Process Argv --crash-reporter-id b18eb1dd-5763-4eb9-9747-ba339864022c
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
vscrpc:30673769
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
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
0ee40948:31013168
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl2:31139839
refactort:31108082
pythonrstrctxt:31112756
flighttreat:31134774
wkspc-onlycs-t:31132770
nativeloc2:31134642
wkspc-ranged-t:31151552
cf971741:31144450
defaultse:31146405
iacca2:31150323
cc771715:31146322

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 4, 2024
@AlexanderPodorov
Copy link
Author

A few examples:
image

@eleanorjboyd
Copy link
Member

Hello! Ok a few questions,

  1. currently branch coverage is not supported, therefore the branch coverage is not taken into account for the percentage in the sidebar- with this in mind do the percentages align more?
  2. For account.py are you saying that it is not listed as covered in the terminal run but is listed in the coverage UI? I think coverage.py just doesn't display all files with complete coverage. Could you send me a screenshot of the account.py file open with the line coverage if you still think it is not correct, I want to see if its highlighted green when coverage was just run.
  3. If you hover over the percentage bar in the UI it will show you like x/x lines covered. With this extra information are there any files that are not aligning with the UI?

@eleanorjboyd eleanorjboyd self-assigned this Oct 4, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 4, 2024
@AlexanderPodorov
Copy link
Author

Hello,

  1. Ah, ok, thanks, these definitely align more.
  2. account.py is fully covered, therefore is excluded from coverage report. This file is good. This was accidentally highlighted, sorry for confusion
  3. Seems like aligning well keeping 1. in mind.
    It also seems like coverage.py does some percentage rounding while Python extension is more precise.
    I think I can take another look once branch coverage is fully supported, otherwise this seems like a guesswork.
    I can close this issue for now if you want.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 4, 2024
@eleanorjboyd
Copy link
Member

Yes- the rounding does exist and I noticed this as well but decided surfacing more precision wasn't bad since it is ultimately a fraction we are evaluating that comes from line number counts. And yes we are looking at branch coverage but currently branch coverage numbers are not exposed by the coverage.py API and therefore I am working with the maintainer there to surface it so we can safely support branch coverage on our end too. Closing as I think this resolves all the issues you surfaced, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-testing triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants