Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added docstrings and 100% test and docstring coverage #4

Merged
merged 16 commits into from
Sep 22, 2022

Conversation

ohmycaptainnemo
Copy link
Contributor

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.

pyproject.toml Outdated
@@ -11,14 +11,16 @@ keywords = ["poetry", "bump", "version", "plugin"]

[tool.poetry.dependencies]
python = "^3.7"
poetry = "^1.2.0a1"
poetry = "^1.2.1"
Copy link
Owner

Choose a reason for hiding this comment

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

Poetry version should not change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will change it back.

Copy link
Owner

Choose a reason for hiding this comment

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

Is poetry.lock up to date now? Did you run poetry lock --no-update?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh actually, I take it back. Do not merge.
For some reason I cannot get this to work with poetry 1.2.0a1. During the resolving dependency step, I just get an error like this:

image

I am not sure why it cannot set attribute. I need to look into this.
Also I was wondering, is there any reason why we cannot use poetry 1.2.1 ?

Copy link
Owner

Choose a reason for hiding this comment

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

People using poetry 1.2.0a1 might also want to use this plugin.

Copy link
Owner

Choose a reason for hiding this comment

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

Can you get it working with ^1.2.0a2? 1.2.0a1 might be broken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh sorry. You make sense.
It is interesting that you should say that because I am having issues with 1.2.0a1.
I will try 1.2.0a2 and see how it goes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is all working for poetry 1.2.0a2.
I have updated poetry.lock and pyproject.toml.

@monim67 monim67 merged commit dd3752d into monim67:main Sep 22, 2022
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