You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The other tests use the customcatch_warnings class but since that inherits from warnings.catch_warnings that'll catch emitted warnings, right. How to get the ones which are logged?
My case: I was writing a test for fitsheader. The script warns if -k option is used and the given keyword is not found.
Same goes for errors. Eg. if file not found. It logs the Error.
Activity
mohanagr commentedon Mar 2, 2017
I am writing a test for
fitsheader. Is there any specific file inastropy/io/fits/tests/data/I should use?MSeifert04 commentedon Mar 2, 2017
@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 👍
mohanagr commentedon Mar 2, 2017
@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?
elehcim commentedon Mar 2, 2017
@mohanagr If you want you can use as a template the tests here:
astropy/io/fits/tests/test_fitsdiff.pyMSeifert04 commentedon Mar 2, 2017
That sounds good.
mohanagr commentedon Mar 3, 2017
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 for
fitsheader. 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.
MSeifert04 commentedon Mar 3, 2017
@mohanagr Is there a need to test exceptional (or warning) cases? Aren't these already tested in the not-script-version of the script?
mohanagr commentedon Mar 3, 2017
@MSeifert04 I saw your comment late. I have implemented a few tests in the initial commit. Please go through.
pllim commentedon Sep 28, 2017
All the checkboxes are checked, so closing.