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

Fix ResourceWarning from unclosed detached data NRRD files #90

Merged

Conversation

addisonElliott
Copy link
Collaborator

Enable all warnings during tests to see additional problems in the code. The following warning appeared:

ResourceWarning: unclosed file <_io.BufferedReader name='<PYNRRD_DIR>\\nrrd\\tests\\data\\BallBinary30x30x30.raw'>
  tb.tb_frame.clear()

Problem resolved by closing the file handle before raising errors. The only time this issue occurs is when the data is detached from the header. The detached data filename is loaded using an open call without a "with" block.

As of now, the warnings are helpful in fixing potential bugs or future issues in the library. However, this filter may need to be updated in the future to ignore issues that are not relevant.
@codecov-io
Copy link

codecov-io commented Mar 30, 2019

Codecov Report

Merging #90 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #90      +/-   ##
==========================================
+ Coverage   99.17%   99.18%   +<.01%     
==========================================
  Files           6        6              
  Lines         363      366       +3     
  Branches      117      117              
==========================================
+ Hits          360      363       +3     
  Misses          1        1              
  Partials        2        2
Impacted Files Coverage Δ
nrrd/reader.py 100% <100%> (ø) ⬆️

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 0dfddeb...5ea0ae6. Read the comment docs.

@addisonElliott addisonElliott changed the title Fix unclosed detached file Fix ResourceWarning from unclosed detached data NRRD files Mar 30, 2019
@addisonElliott addisonElliott merged commit 204b7df into mhe:master Apr 2, 2019
@addisonElliott addisonElliott deleted the fix-unclosed-detached-file branch April 2, 2019 16:09
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