Skip to content

Conversation

@rruuaanng
Copy link
Contributor

@rruuaanng rruuaanng commented Nov 18, 2024

Before with the current trace module, you'll have a summary output like this:

lines   cov%   module   (path)
  154    24%   _weakrefset   (/home/gaogaotiantian/programs/mycpython/Lib/_weakrefset.py)
 1293     0%   ast   (/home/gaogaotiantian/programs/mycpython/Lib/ast.py)
  160     5%   bz2   (/home/gaogaotiantian/programs/mycpython/Lib/bz2.py)
  133    39%   cProfile   (/home/gaogaotiantian/programs/mycpython/Lib/cProfile.py)
  903     7%   collections.__init__   (/home/gaogaotiantian/programs/mycpython/Lib/collections/__init__.py)

This patch increase the precision of cov% to one decimal place so you'll have something like:

lines    cov%   module   (path)
  154   24.7%   _weakrefset   (/home/gaogaotiantian/programs/mycpython/Lib/_weakrefset.py)
 1293    0.2%   ast   (/home/gaogaotiantian/programs/mycpython/Lib/ast.py)
  160    5.0%   bz2   (/home/gaogaotiantian/programs/mycpython/Lib/bz2.py)
  133   39.8%   cProfile   (/home/gaogaotiantian/programs/mycpython/Lib/cProfile.py)
  903    7.8%   collections.__init__   (/home/gaogaotiantian/programs/mycpython/Lib/collections/__init__.py)

So, it makes the impact of small changes visible ;)

This may seem a bit non-sense at the first glance, but it's related to a very practical question - how do we know our coverage improved after some new test cases? With integer percentage, we have a 1% resolution, which means we can't tell if there's a one line improvement if the file is larger than 100 lines. For a file that has 1000 lines, the resolution is 10 lines! It's not trivial!

@rruuaanng rruuaanng marked this pull request as ready for review November 18, 2024 16:02
Copy link
Contributor

@skirpichev skirpichev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly LGTM, with one comment.

Also, you could change pr description to be more suitable as commit message. Just mention what you do and why it's useful.

@rruuaanng
Copy link
Contributor Author

cc @erlend-aasland
For this issue and PR. WDYT? In the discussion, it was specifically mentioned that they hoped to get advice from core developers :)

@skirpichev skirpichev self-requested a review November 26, 2024 14:34
@erlend-aasland erlend-aasland changed the title gh-112192: Increase the cov% of trace to one decimal place gh-112192: Increase the trace module coverage precision to one decimal Dec 3, 2024
@erlend-aasland erlend-aasland merged commit 12397a5 into python:main Dec 3, 2024
42 checks passed
@erlend-aasland
Copy link
Contributor

Thanks for the PR, RUANG; thanks for the review Sergey.

@rruuaanng rruuaanng deleted the gh112192 branch December 4, 2024 03:45
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Jan 8, 2025
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants