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

Bring test coverage to 100%, reorganize tests #70

Merged
merged 26 commits into from
Dec 20, 2021

Conversation

tlambert03
Copy link
Collaborator

@tlambert03 tlambert03 commented Dec 17, 2021

This brings complete test coverage to npe2, (and requires 100% for future PRs).

I tried to touch as little of the actual code as possible, but inevitably needed to shuffle a few things around (like validators, etc...) hopefully it's not too hard to review. But, it's all tested! 😂

you'll see a lot of # pragma: no cover ... mostly they are on exceptions and loop continuations, those are fine with me (mocking test cases that specifically fail those conditions just to see the exception get raised is not terribly useful, and each one indicates that a human has considered that line). I'm fine with using # pragma: no cover going forward when it feels like a "trivial" thing that

@codecov
Copy link

codecov bot commented Dec 17, 2021

Codecov Report

Merging #70 (315beb3) into main (b0e8a6d) will increase coverage by 23.82%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main      #70       +/-   ##
===========================================
+ Coverage   76.09%   99.91%   +23.82%     
===========================================
  Files          25       22        -3     
  Lines        1368     1207      -161     
===========================================
+ Hits         1041     1206      +165     
+ Misses        327        1      -326     
Impacted Files Coverage Δ
npe2/manifest/menus.py 100.00% <ø> (+3.44%) ⬆️
npe2/manifest/themes.py 100.00% <ø> (+3.84%) ⬆️
npe2/types.py 100.00% <ø> (+4.16%) ⬆️
npe2/_from_npe1.py 100.00% <100.00%> (+32.81%) ⬆️
npe2/_plugin_manager.py 100.00% <100.00%> (+9.89%) ⬆️
npe2/cli.py 100.00% <100.00%> (+62.06%) ⬆️
npe2/manifest/_validators.py 100.00% <100.00%> (ø)
npe2/manifest/commands.py 100.00% <100.00%> (+22.22%) ⬆️
npe2/manifest/schema.py 100.00% <100.00%> (+19.42%) ⬆️
npe2/manifest/utils.py 100.00% <100.00%> (+16.66%) ⬆️
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0e8a6d...315beb3. Read the comment docs.

@tlambert03 tlambert03 marked this pull request as ready for review December 18, 2021 19:08
@tlambert03 tlambert03 requested a review from nclack December 18, 2021 19:18
@tlambert03 tlambert03 changed the title Increase test coverage, reorganize tests Bring test coverage to 100%, reorganize tests Dec 18, 2021
@tlambert03
Copy link
Collaborator Author

@nclack, let me know if you'd like time to review this PR. I know we're in a holiday stretch here, so I expect you won't be as active as usual. This PR has the potential to conflict with anything else I work on though, so I'd prefer to get it in sooner than later. (as mentioned, it really doesn't touch much of the logic in the code, just completes coverage)

Copy link
Collaborator

@nclack nclack left a comment

Choose a reason for hiding this comment

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

amazing. I flagged a couple pragmas, but I don't feel strongly. It's so nice to have this.

npe2/_from_npe1.py Show resolved Hide resolved
@@ -313,7 +309,7 @@ def get_writer(

for writer in self.iter_compatible_writers(layer_types):
if plugin_name and not writer.command.startswith(plugin_name):
continue
continue # pragma: no cover
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will get hit when a user has multiple single-image-layer writers installed (from different plugins) and is querying by plugin_name.

Right now I believe the testing is focused on environments with just one test plugin installed. Should we add another to cover this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the logic of simply continuing is simple enough. But I refactored out the continue and the pragma with if not plugin_name or writer.command.startswith(plugin_name):

@tlambert03 tlambert03 merged commit f580635 into napari:main Dec 20, 2021
@tlambert03 tlambert03 deleted the coverage branch December 20, 2021 18:41
@nclack nclack mentioned this pull request Dec 20, 2021
17 tasks
@tlambert03 tlambert03 added the tests related to testing or CI label Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests related to testing or CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants