python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.62k stars 2.27k forks source link

Add coverage report on testing #9629

Closed estepona closed 1 month ago

estepona commented 2 months ago

Issue Kind

Brand new capability

Description

Hi. As mentioned in this Test Suite Cleanup issue, there might be some code needing coverage, yet running poetry run pytest doesn't tell the coverage. I'd like to contribute to this task by first adding a coverage report that everyone can see locally and in CI.

Impact

Rendering a coverage report by running the tests.

Workarounds

N/A

estepona commented 2 months ago

Hi @abn @Secrus @dimbleby @radoering, could you please advise?

radoering commented 2 months ago

Might make sense.

It should probably mentioned in https://python-poetry.org/docs/contributing#local-development (source) how to create a coverage report locally.

In CI, the challenge is to create coverage reports for all Python versions and platforms and combine the results. Further, we should keep an eye on runtimes (how much slower tests become with coverage).

Secrus commented 2 months ago

Since we have pytest-cov plugin, I think seeing local coverage would be as simple as running poetry run pytest --cov=src/poetry --cov-report term. I would be all for adding the coverage report on CI, but since GH doesn't support reading coverage report files from CI, that would have to be hacked around, outsourced to another service (like codecov), or would only be visible when browsing CI logs, which expire after some time. Overall, it's not worth the work needed and the maintenance burden. I agree that info about how to see coverage locally should be added to contributing docs, but nothing beyond that.

github-actions[bot] commented 2 days ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.