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

🧪🚑 Fix coverage.py-included paths @ XML #1074

Conversation

webknjaz
Copy link
Member

@webknjaz webknjaz commented Sep 1, 2024

This patch fixes the directory misattribution of test file paths by marking the entire repository directory as source.

fixes #1026 (comment)
closes #1029
closes #1071
ref https://github.com/orgs/aio-libs/discussions/36

This patch fixes the directory misattribution of test file paths by
marking the entire repository directory as source.
@webknjaz webknjaz added the bot:chronographer:skip This PR does not need to include a change note label Sep 1, 2024
@webknjaz webknjaz requested a review from bdraco September 1, 2024 01:51
Copy link

codecov bot commented Sep 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.89%. Comparing base (3d5ce65) to head (3effd15).
Report is 345 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1074       +/-   ##
===========================================
+ Coverage   62.40%   92.89%   +30.49%     
===========================================
  Files          38       26       -12     
  Lines        6626     4295     -2331     
  Branches      356      356               
===========================================
- Hits         4135     3990      -145     
+ Misses       2464      279     -2185     
+ Partials       27       26        -1     
Flag Coverage Δ
CI-GHA 92.87% <ø> (+30.49%) ⬆️
MyPy 25.67% <ø> (ø)
OS-Linux 99.25% <ø> (ø)
OS-Windows 99.58% <ø> (ø)
OS-macOS 99.02% <ø> (ø)
Py-3.10.11 98.90% <ø> (ø)
Py-3.10.14 99.10% <ø> (ø)
Py-3.11.9 99.10% <ø> (ø)
Py-3.12.5 99.10% <ø> (ø)
Py-3.13.0-rc.1 99.10% <ø> (ø)
Py-3.8.10 98.87% <ø> (ø)
Py-3.8.18 99.07% <ø> (ø)
Py-3.9.13 98.87% <ø> (ø)
Py-3.9.19 99.07% <ø> (ø)
Py-pypy7.3.11 99.39% <ø> (ø)
Py-pypy7.3.16 99.42% <ø> (ø)
VM-macos-latest 99.02% <ø> (ø)
VM-ubuntu-latest 99.25% <ø> (ø)
VM-windows-latest 99.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Works for me. This is less invasive than the alternative #1071

@bdraco bdraco merged commit 94b6b51 into aio-libs:master Sep 1, 2024
45 of 48 checks passed
@bdraco
Copy link
Member

bdraco commented Sep 1, 2024

We are still getting misses for multi-line coverage but its much better that we can see whats covered now 👍

@webknjaz
Copy link
Member Author

webknjaz commented Sep 1, 2024

@bdraco multiline? do you mean branches?

@bdraco
Copy link
Member

bdraco commented Sep 1, 2024

Statements that span more than one line.

@bdraco
Copy link
Member

bdraco commented Sep 1, 2024

Ie

x = URL(
   Code in here shows as not covered
)

@bdraco
Copy link
Member

bdraco commented Sep 1, 2024

nedbat/coveragepy#571

@webknjaz
Copy link
Member Author

webknjaz commented Sep 2, 2024

@bdraco that shows up as covered for me..

@webknjaz
Copy link
Member Author

webknjaz commented Sep 2, 2024

@bdraco oh... I see what you're talking about! That's not related to coverage.py. It excludes those lines (so they aren't marked as covered or uncovered). However, we also upload coverage reports generated by MyPy and it explicitly marks the lines you're referring to as uncovered.

The fix should be done in the context of MyPy, not pytest.

@webknjaz
Copy link
Member Author

webknjaz commented Sep 2, 2024

One way to spot this would be toggling the flags on the UI. For example, if you go to Codecov and select a flag only reported from pytest jobs (like Py-3.11.9), you can see that coverage is actually 100% thanks to those lines you referred being excluded: https://app.codecov.io/gh/aio-libs/yarl/pull/1074/blob/tests/test_url.py?flags%5B0%5D=Py-3.11.9.

Meanwhile, I've added a pytest flag so that it'd be possible to just select MyPy or pytest and show one type of coverage vs. the other w/o having to guess flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:skip This PR does not need to include a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants