Skip to content

Add CI workflow to check test coverage#225

Merged
Snapex2409 merged 30 commits intoprecice:developfrom
AdityaGupta716:ci-test-coverage
Mar 14, 2026
Merged

Add CI workflow to check test coverage#225
Snapex2409 merged 30 commits intoprecice:developfrom
AdityaGupta716:ci-test-coverage

Conversation

@AdityaGupta716
Copy link
Copy Markdown
Contributor

Closes #55

Adds a workflow to check test coverage on every push and pull request using Coverage.py.

Changes:

  • Added check_coverage.py script that runs coverage report and fails if coverage is below a predefined threshold (currently set to 70%)
  • Added check-coverage.yml workflow that runs all unit tests with coverage and calls the script to check the threshold

The threshold can be adjusted in check_coverage.py as the codebase grows.

@AdityaGupta716
Copy link
Copy Markdown
Contributor Author

AdityaGupta716 commented Feb 24, 2026

@MakisH @IshaanDesai, plz review! The threshold is currently set to 70% in check_coverage.py .if u want smthing different let me know.

@MakisH MakisH added the GSoC Contributed in the context of the Google Summer of Code label Feb 25, 2026
@precice-bot
Copy link
Copy Markdown

This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there:

https://precice.discourse.group/t/gsoc-2026-aditya-gupta/2773/1

@IshaanDesai
Copy link
Copy Markdown
Member

@AdityaGupta716 can you please take a look at the CI output of the test coverage workflow? It seems like the workflow got stuck.

@AdityaGupta716
Copy link
Copy Markdown
Contributor Author

@IshaanDesai hi, fixed the issue the workflow was hanging because unittest discover was picking up the parallel tests (test_adaptivity_parallel.py, test_global_adaptivity_lb.py) which need MPI to run. changed it to run each test file explicitly instead — same approach as the existing run-unit-tests.yml. Also current coverage is around 22%, so the 70% threshold might need adjusting , happy to change it to whatever you think fits!

@IshaanDesai
Copy link
Copy Markdown
Member

Good work so far! I am surprised that the test coverage is not 70%, though I perceive it as having a certain value. The CI log, however, shows 0% test coverage, which seems definitely incorrect. Can you please take a look at what is going on?

@AdityaGupta716
Copy link
Copy Markdown
Contributor Author

hi @IshaanDesai fixed the 0% coverage issue! The problem was the .coverage file wasn't being found correctly. The workflow now runs all serial and parallel unit tests with mpirun and combines the results, giving a real coverage of ~61%. I've set the threshold to 60% for now plz review and let me know if you think it should be different

@IshaanDesai IshaanDesai requested a review from Snapex2409 March 7, 2026 05:43
@IshaanDesai
Copy link
Copy Markdown
Member

@Snapex2409, to increase test coverage, some tests on things that you recently implemented have been added. Can you please go over them to ensure that they make sense?

Copy link
Copy Markdown
Collaborator

@Snapex2409 Snapex2409 left a comment

Choose a reason for hiding this comment

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

Overall, nicely done. With the requested changes, coverage should also increase a bit.

Comment thread micro_manager/interpolation.py
Comment thread tests/unit/test_micro_simulation.py
Comment thread .github/workflows/check-coverage.yml
Copy link
Copy Markdown
Collaborator

@Snapex2409 Snapex2409 left a comment

Choose a reason for hiding this comment

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

Just the small refactory, then we should be ready to merge in my opinion.
And good thinking to mock the connection here 👍

Comment thread tests/unit/test_micro_simulation.py
@AdityaGupta716
Copy link
Copy Markdown
Contributor Author

@Snapex2409 nah no reasons, moved it up

@Snapex2409 Snapex2409 merged commit d1d4ef0 into precice:develop Mar 14, 2026
10 checks passed
@IshaanDesai IshaanDesai mentioned this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Contributed in the context of the Google Summer of Code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CI to check test coverage

5 participants