monim67 / poetry-bumpversion

Poetry plugin to update __version__ in __init__ file and other files containing version strings
https://pypi.org/project/poetry-bumpversion/
MIT License
81 stars 4 forks source link

Added docstrings and 100% test and docstring coverage #4

Closed ohmycaptainnemo closed 1 year ago

ohmycaptainnemo commented 1 year ago

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 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:

  1. The case in which the file with the version is not found.
  2. 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: image

Docstring coverage report: image

I hope this helps. And also thank you very much for your hard work and contributions.