I noticed that the tests only covered the code in the tests directory and there was no visibility on the source code coverage of the plugin code (code coverage was only 47% I think). I used poe poetry plugin like how you have done for linting and added a test-cov task for test coverage and a docstring-cov task for interrogating docstring coverage.
In the test-cov task, one has the option of publishing the coverage report either as xml which is good for uploading to a website like Codecov.io during the CI/CD actions and get a test coverage badge, or save the coverage report as html, for local viewing or download. I have left it as xml for now.
I changed the testing code to make sure while the tests in the tests directory run, the plugin source code also gets coverage. After getting visibility on the source code coverage, I noticed that everything is being covered by the tests except for a couple of minor if statements for the following cases:
The case in which the file with the version is not found.
The case in which the version was already what it needs to be and there is nothing to update.
I have added directories for those test cases.
Running the docstring coverage task currently will give you a .svg badge for docstring coverage too in the root directory.
Test coverage report in html:
Docstring coverage report:
I hope this helps. And also thank you very much for your hard work and contributions.
Hi @monim67,
I noticed that the tests only covered the code in the
tests
directory and there was no visibility on the source code coverage of the plugin code (code coverage was only 47% I think). I usedpoe
poetry plugin like how you have done for linting and added atest-cov
task for test coverage and adocstring-cov
task for interrogating docstring coverage. In thetest-cov
task, one has the option of publishing the coverage report either asxml
which is good for uploading to a website like Codecov.io during the CI/CD actions and get a test coverage badge, or save the coverage report ashtml
, for local viewing or download. I have left it asxml
for now.I changed the testing code to make sure while the tests in the
tests
directory run, the plugin source code also gets coverage. After getting visibility on the source code coverage, I noticed that everything is being covered by the tests except for a couple of minor if statements for the following cases:I have added directories for those test cases.
Running the docstring coverage task currently will give you a
.svg
badge for docstring coverage too in the root directory.Test coverage report in html:![image](https://user-images.githubusercontent.com/38586420/191682540-5c58925a-11cb-4980-91db-a7f46d0abce1.png)
Docstring coverage report:![image](https://user-images.githubusercontent.com/38586420/191683025-7600496a-99b1-4607-a834-527ad1463a77.png)
I hope this helps. And also thank you very much for your hard work and contributions.