bloomberg / memray

Memray is a memory profiler for Python
https://bloomberg.github.io/memray/
Apache License 2.0
13.17k stars 392 forks source link

Increase Python Coverage #410

Closed apurvakhatri closed 1 year ago

apurvakhatri commented 1 year ago

Issue number of the reported bug or feature request: #351

Describe your changes The changes are - Python coverage report is generated & published to Codecov. Further, The report is analyzed & pragma no cover is added to increase test coverage.

Testing performed I tested on a personal fork of the project using appropriate secrets for personal CodeCov.

Additional context In order to publish python coverage to codecov build.yml had to be modified. During build the python coverage had to be performed using the development dependencies on ubuntu-latest & alpine linux container (Line 67 & 101 of build.yml respectively). This part of the build was failing as the systems were lacing lcov. Therefore lcov was added using apt-get & apk add for ubuntu & alpine respectively. Further, the publishing of code coverage report was resolved, but still 1 test is failing as the genhtml is unable to ignore the linecov error on alpine linux whereas it ignores it on ubuntu-latest. Any help on how to resolve this 1 check would be greatly appreciated. Thank you!

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +6.48 :tada:

Comparison is base (ae12d50) 85.18% compared to head (42c545c) 91.66%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #410 +/- ## ========================================== + Coverage 85.18% 91.66% +6.48% ========================================== Files 29 90 +61 Lines 3631 10503 +6872 Branches 0 1448 +1448 ========================================== + Hits 3093 9628 +6535 - Misses 538 872 +334 - Partials 0 3 +3 ``` | Flag | Coverage Δ | | |---|---|---| | cpp | `85.04% <ø> (-0.14%)` | :arrow_down: | | python_and_cython | `95.16% <100.00%> (?)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#carryforward-flags-in-the-pull-request-comment) to find out more. | [Impacted Files](https://app.codecov.io/gh/bloomberg/memray/pull/410?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg) | Coverage Δ | | |---|---|---| | [tests/unit/test\_reader.py](https://app.codecov.io/gh/bloomberg/memray/pull/410?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-dGVzdHMvdW5pdC90ZXN0X3JlYWRlci5weQ==) | `100.00% <ø> (ø)` | | | [tests/unit/test\_stats\_reporter.py](https://app.codecov.io/gh/bloomberg/memray/pull/410?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-dGVzdHMvdW5pdC90ZXN0X3N0YXRzX3JlcG9ydGVyLnB5) | `100.00% <ø> (ø)` | | | [tests/integration/test\_api.py](https://app.codecov.io/gh/bloomberg/memray/pull/410?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-dGVzdHMvaW50ZWdyYXRpb24vdGVzdF9hcGkucHk=) | `98.07% <100.00%> (ø)` | | | [tests/integration/test\_extensions.py](https://app.codecov.io/gh/bloomberg/memray/pull/410?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-dGVzdHMvaW50ZWdyYXRpb24vdGVzdF9leHRlbnNpb25zLnB5) | `100.00% <100.00%> (ø)` | | | [tests/integration/test\_processes.py](https://app.codecov.io/gh/bloomberg/memray/pull/410?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-dGVzdHMvaW50ZWdyYXRpb24vdGVzdF9wcm9jZXNzZXMucHk=) | `31.52% <100.00%> (ø)` | | | [tests/integration/test\_tracing.py](https://app.codecov.io/gh/bloomberg/memray/pull/410?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-dGVzdHMvaW50ZWdyYXRpb24vdGVzdF90cmFjaW5nLnB5) | `99.81% <100.00%> (ø)` | | | [tests/integration/test\_tracking.py](https://app.codecov.io/gh/bloomberg/memray/pull/410?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg#diff-dGVzdHMvaW50ZWdyYXRpb24vdGVzdF90cmFja2luZy5weQ==) | `97.38% <100.00%> (ø)` | | ... and [56 files with indirect coverage changes](https://app.codecov.io/gh/bloomberg/memray/pull/410/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=bloomberg)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

pablogsal commented 1 year ago

Hummm, seems that some of the parts that were added are having some problem (for some reason only on Alpine):

/venv/bin/python -m coverage lcov -i -o pycoverage.lcov
Wrote LCOV report to pycoverage.lcov
genhtml *coverage.lcov  --branch-coverage --output-directory memray-coverage
Found 61 entries.
Found common filename prefix "/__w/memray/memray"
Generating output.
Processing file src/memray/reporters/summary.py
  lines=19 hit=19 branches=3 hit=3
Processing file src/memray/commands/summary.py
  lines=35 hit=35 branches=8 hit=8
Processing file tests/integration/test_processes.py
genhtml: ERROR: line 0 of tests/integration/test_processes.py has branchcov but no linecov data
    (use "genhtml --ignore-errors category ..." to bypass this error)
make: *** [Makefile:70: pycoverage] Error 1