Repository navigation
Add tests for scripts in io.fits #5799
Description
Activity
- added and removed
on Feb 13, 2017 I am writing a test for
fitsheader. Is there any specific file inastropy/io/fits/tests/data/I should use?@mohanagr At first, it would be nice to have some proof of concept that the CI properly test the script (so we can see if coverage and the CI work).
So if you could submit a pull request for a script-test (doesn't matter which file) that would be really great 👍
@MSeifert04 Since I'm new to writing tests, for a start I'll just write a test to compare outputs for different options and submit a PR?
@mohanagr If you want you can use as a template the tests here:
astropy/io/fits/tests/test_fitsdiff.pyReacted by Mohan AgrawalI'll just write a test to compare outputs for different options and submit a PR?
That sounds good.
The other tests use the custom
catch_warningsclass but since that inherits fromwarnings.catch_warningsthat'll catch emitted warnings, right. How to get the ones which are logged?
My case: I was writing a test forfitsheader. The script warns if-koption is used and the given keyword is not found.
Same goes for errors. Eg. if file not found. It logs the Error.@mohanagr Is there a need to test exceptional (or warning) cases? Aren't these already tested in the not-script-version of the script?
Reacted by Brigitta Sipőcz and P. L. Lim@MSeifert04 I saw your comment late. I have implemented a few tests in the initial commit. Please go through.
All the checkboxes are checked, so closing.
Reacted by Simon Conseil and Michele Mastropietro
Tests are needed for astropy/io/fits/scripts/
astropy/io/fits/scripts/fitsdiff.pyastropy/io/fits/scripts/fitscheck.pyastropy/io/fits/scripts/fitsheader.pyCiting @bsipocz: "Having broken command line tools is much much worse than not having them at all".
Very true ;-)
cc @MSeifert04