Skip to content

build: add test coverage into pipeline + pre-commit#160

Open
dartanghan wants to merge 10 commits intoarm:mainfrom
dartanghan:build/test-coverage
Open

build: add test coverage into pipeline + pre-commit#160
dartanghan wants to merge 10 commits intoarm:mainfrom
dartanghan:build/test-coverage

Conversation

@dartanghan
Copy link
Contributor

@dartanghan dartanghan commented Mar 4, 2026

Hey team!

I've added pytest-cov to our pipeline and pre-commit. Unfortunately we are under 40%, so I placed a threshold of 35% to start.

  • pre-commit edited and added a local pytest --cov command
  • pyproject.toml adjusted and added a dependency group DEV
  • pyproject.toml adjusted and pytest and pytest-cov added to DEV dep group
  • test.yml CI pipeline edited and added coverage

The pytest-cov also tests the code, so I've replaced the pytest by pytest --cov


TOTAL 2355 1431 39%
Required test coverage of 35% reached. Total coverage: 39.24%

$ pre-commit
black................................................(no files to check)Skipped
ruff (legacy alias)..................................(no files to check)Skipped
check yaml...........................................(no files to check)Skipped
fix end of files.....................................(no files to check)Skipped
trim trailing whitespace.............................(no files to check)Skipped
test-coverage............................................................Passed

I hope this addition can be useful.

PS: in pipeline only 20% is covered. Reduced the threshold

@dartanghan dartanghan closed this Mar 4, 2026
@dartanghan dartanghan reopened this Mar 4, 2026
@dartanghan
Copy link
Contributor Author

Just noticed that pre-commit is also executed after the tests.

  • Removed the tests from CI pipeline as pre-commit is called with tests + coverage
  • Added an option pass_filenames: false which avoid to send all file names to pytest, so it wil test the whole structure.
  • Kept the threshold in .pre-commit ( --cov-fail-under=20)

@dartanghan
Copy link
Contributor Author

dartanghan commented Mar 4, 2026

black....................................................................Passed
ruff (legacy alias)......................................................Passed
check yaml...............................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
test+coverage............................................................Passed  
% uv run pytest --cov=src
Name                                          Stmts   Miss  Cover
-----------------------------------------------------------------
src/metis/__init__.py                             0      0   100%
src/metis/__main__.py                             3      3     0%
src/metis/cli/__init__.py                         0      0   100%
src/metis/cli/commands.py                        62     62     0%
src/metis/cli/entry.py                          149    149     0%
src/metis/cli/exporters.py                       91     91     0%
src/metis/cli/utils.py                          188    188     0%
src/metis/configuration.py                      105     83    21%
src/metis/engine/__init__.py                      2      0   100%
src/metis/engine/core.py                        318     99    69%
src/metis/engine/diff_utils.py                   29      1    97%
src/metis/engine/graphs/__init__.py               3      0   100%
src/metis/engine/graphs/ask.py                   34      1    97%
src/metis/engine/graphs/review.py               166     95    43%
src/metis/engine/graphs/schemas/__init__.py       2      0   100%
src/metis/engine/graphs/schemas/review.py        32      7    78%
src/metis/engine/graphs/types.py                 36      0   100%
src/metis/engine/graphs/utils.py                 79     22    72%
src/metis/engine/helpers.py                      43     17    60%
src/metis/exceptions.py                          18      4    78%
src/metis/plugin_loader.py                       98     71    28%
src/metis/plugins/__init__.py                     0      0   100%
src/metis/plugins/base.py                        17      5    71%
src/metis/plugins/c_plugin.py                    17      3    82%
src/metis/plugins/cpp_plugin.py                  18      5    72%
src/metis/plugins/go_plugin.py                   18      5    72%
src/metis/plugins/javascript_plugin.py           18      5    72%
src/metis/plugins/php_plugin.py                  18      5    72%
src/metis/plugins/python_plugin.py               17      4    76%
src/metis/plugins/ruby_plugin.py                 17     17     0%
src/metis/plugins/rust_plugin.py                 17      5    71%
src/metis/plugins/solidity_plugin.py             18     18     0%
src/metis/plugins/tb_plugin.py                   17      5    71%
src/metis/plugins/terraform_plugin.py            17      5    71%
src/metis/plugins/typescript_plugin.py           18      5    72%
src/metis/providers/__init__.py                   0      0   100%
src/metis/providers/azure_openai.py              52     52     0%
src/metis/providers/base.py                      17     17     0%
src/metis/providers/ollama.py                    20     20     0%
src/metis/providers/openai.py                    10     10     0%
src/metis/providers/openai_compatible.py        102    102     0%
src/metis/providers/registry.py                  38     38     0%
src/metis/providers/vllm.py                      14     14     0%
src/metis/sarif/__init__.py                       0      0   100%
src/metis/sarif/utils.py                         10      2    80%
src/metis/sarif/writer.py                        79      8    90%
src/metis/utils.py                              150     60    60%
src/metis/vector_store/__init__.py                0      0   100%
src/metis/vector_store/base.py                   29     13    55%
src/metis/vector_store/chroma_store.py           61     28    54%
src/metis/vector_store/pgvector_store.py         87     87     0%
src/metis/version.py                              1      0   100%
-----------------------------------------------------------------
TOTAL                                          2355   1431    39%

mpekatsoula
mpekatsoula previously approved these changes Mar 5, 2026
Copy link
Contributor

@mpekatsoula mpekatsoula left a comment

Choose a reason for hiding this comment

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

Thanks @dartanghan this looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants