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

TST: Investigate ResourceWarning unclosed file #119

Open
pllim opened this issue Apr 3, 2020 · 0 comments
Open

TST: Investigate ResourceWarning unclosed file #119

pllim opened this issue Apr 3, 2020 · 0 comments

Comments

@pllim
Copy link
Contributor

pllim commented Apr 3, 2020

Some tests complain about unclosed files. These are probably not worth fixing since those functions are not widely used anymore, if at all. But still, something to keep in mind.

lib/stsci/tools/tests/test_check_files.py::test_check_files
  .../tools/check_files.py:61: ResourceWarning: unclosed file <_io.FileIO name='.../tests/data/acs_test.fits' mode='rb' closefd=True>
    newfilelist = [hdul.filename() for hdul in newfilelist]

lib/stsci/tools/tests/test_check_files.py::test_check_files
  .../tools/check_files.py:39: ResourceWarning: unclosed file <_io.FileIO name='.../tools/tests/data/o4sp040b0_raw.fits' mode='rb' closefd=True>
    newfilelist, ivmlist = checkStisFiles(newfilelist, ivmlist)

lib/stsci/tools/tests/test_check_files.py::test_waivered_fits
  .../tools/convertwaiveredfits.py:563: ResourceWarning: unclosed file <_io.FileIO name='u40x010hm_c0f.fits' mode='rb' closefd=True>
    return func(*(waiveredObject,outputFileName,forceFileOutput,verbose))

lib/stsci/tools/tests/test_check_files.py::test_waivered_fits
  .../tools/check_files.py:61: ResourceWarning: unclosed file <_io.FileIO name='u40x010hm_c0h.fits' mode='rb+' closefd=True>
    newfilelist = [hdul.filename() for hdul in newfilelist]
@pllim pllim changed the title TST: Close FITS files gracefully in tests TST: Investigate ResourceWarning unclosed file Apr 3, 2020
@pllim pllim added tests and removed enhancement labels Apr 3, 2020
pllim added a commit to pllim/stsci.tools that referenced this issue Apr 3, 2020
* Display pytest header correctly.
* Make test generate output in tmpdir, not cwd.
* Close open file in test gracefully.
* Ignore remaining ResourceWarning, see spacetelescope#119.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant