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

Prevent obsolete reports about failure of cleaning viewer instances #5317

Merged
merged 1 commit into from Nov 25, 2022

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Nov 8, 2022

Description

This is often the thing that if the test is failed, then cleaning of the viewer is failed. At the make_napari_viewer fixture is long, most of the error log is occupied by information of failure in the fixture, not the actual error message.

We also do not clean instances, so the next test crash because of the previous test crash. I have added a clean step to prevent this.

Type of change

  • Bug-fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

References

How has this been tested?

  • example: the test suite for my feature covers cases x, y, and z
  • example: all tests pass with my change
  • example: I check if my changes works with both PySide and PyQt backends
    as there are small differences between the two Qt bindings.

Final checklist:

  • My PR is the minimum possible work for the desired functionality
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • If I included new strings, I have used trans. to make them localizable.
    For more information see our translations guide.

@codecov
Copy link

codecov bot commented Nov 8, 2022

Codecov Report

Merging #5317 (4211b18) into main (8a78b3c) will increase coverage by 0.01%.
The diff coverage is 62.50%.

@@            Coverage Diff             @@
##             main    #5317      +/-   ##
==========================================
+ Coverage   89.07%   89.08%   +0.01%     
==========================================
  Files         581      581              
  Lines       49233    49241       +8     
==========================================
+ Hits        43853    43866      +13     
+ Misses       5380     5375       -5     
Impacted Files Coverage Δ
napari/utils/_testsupport.py 63.55% <62.50%> (-0.08%) ⬇️
napari/layers/image/image.py 95.92% <0.00%> (+0.23%) ⬆️
napari/utils/theme.py 89.79% <0.00%> (+0.68%) ⬆️
napari/utils/info.py 83.33% <0.00%> (+1.11%) ⬆️
napari/layers/image/_image_slice.py 100.00% <0.00%> (+2.38%) ⬆️
napari/_qt/__init__.py 55.17% <0.00%> (+6.89%) ⬆️
...layers/image/experimental/_chunked_image_loader.py 96.00% <0.00%> (+8.00%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@brisvag
Copy link
Contributor

brisvag commented Nov 9, 2022

If I understand correctly what this fixes, thanks so much! This has been annoying me to no end 😆

I don't quite follow the first chunk of code though.

@Carreau Carreau changed the title Prevent obsolete reports about faliture of cleanig viewer instances Prevent obsolete reports about failure of cleaning viewer instances Nov 9, 2022
Copy link
Contributor

@Carreau Carreau left a comment

Choose a reason for hiding this comment

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

LGTM.

_do_not_inline_below = len(QtViewer._instances)

QtViewer._instances.clear() # clear to prevent fail of next test
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why i didn't do that originally.

@Czaki Czaki merged commit 2b084a6 into napari:main Nov 25, 2022
@Czaki Czaki deleted the feature/reduce_noise_on_test_fail branch November 25, 2022 23:20
@Czaki Czaki added this to the 0.5.0 milestone Nov 30, 2022
@Czaki Czaki added the bugfix PR with bugfix label Dec 5, 2022
@Czaki Czaki mentioned this pull request Jun 7, 2023
@Czaki Czaki modified the milestones: 0.5.0, 0.4.18 Jun 16, 2023
@Czaki Czaki added the triaged-0.4.18 To mark PR that is triaged in 0.4.18 release process label Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix PR with bugfix triaged-0.4.18 To mark PR that is triaged in 0.4.18 release process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants