Skip to content

test: start tracking test coverage#3061

Merged
anakin87 merged 3 commits into
mainfrom
coverage
Mar 31, 2026
Merged

test: start tracking test coverage#3061
anakin87 merged 3 commits into
mainfrom
coverage

Conversation

@anakin87

@anakin87 anakin87 commented Mar 30, 2026

Copy link
Copy Markdown
Member

Related Issues

We want to start tracking test coverage and add comments on PRs with this info.
Ideally, we want to track unit test coverage, but also secondarily keep track of combined test coverage (for some integrations like Document Stores, most tests are integration tests).

We would also like to avoid relying on hosted tools.

I have investigated several options involving GitHub actions, but I finally chose https://github.com/py-cov-action/python-coverage-comment-action for its ability to show positive or negative variations of test coverage natively.

Proposed Changes:

This is a pilot, so I am just introducing this change for the Kreuzberg integration.

  • we now also run tests on pushes to main (just one operating system and one Python version) to populate baseline coverage (stored on a branch)
    • we store both unit tests coverage and combined coverage. Currently, combined coverage is not shown, but I'd plan to show it in the README when all integrations are covered by this change.
      Result should look like this:
image
  • using the mentioned action on PRs, prepare and save a coverage comment as a GitHub artifact
  • another workflow takes these comments and publishes them on the PR (this split is needed to make everything work securely when PRs from forks are expected - Docs)

How did you test it?

I tried this extensively on my fork. See for example anakin87#5
image

Checklist

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (kreuzberg)

This PR does not seem to contain any modification to coverable code.

@anakin87 anakin87 marked this pull request as ready for review March 30, 2026 16:36
@anakin87 anakin87 requested a review from a team as a code owner March 30, 2026 16:36
@anakin87 anakin87 requested review from davidsbatista and sjrl and removed request for a team and sjrl March 30, 2026 16:36
@anakin87 anakin87 self-assigned this Mar 30, 2026
@davidsbatista

Copy link
Copy Markdown
Contributor

Looks good to me, seems that the comment posted on PRs will exclude integration test coverage? Is the reason that some community members PR don't run the integration tests?

@davidsbatista davidsbatista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM - just a question/curiosity

@anakin87

Copy link
Copy Markdown
Member Author

Looks good to me, seems that the comment posted on PRs will exclude integration test coverage? Is the reason that some community members PR don't run the integration tests?

We don't expose API keys on PRs running from forks for security reasons. So, in this case, integration tests requiring API keys are skipped and combined coverage cannot be computed.

@anakin87 anakin87 merged commit 8a8d955 into main Mar 31, 2026
6 checks passed
@anakin87 anakin87 deleted the coverage branch March 31, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants