-
-
Notifications
You must be signed in to change notification settings - Fork 408
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
remove call to system-wide gunzip. Use python version instead. #1613
Conversation
@keflavich you may want to have a look! |
Looks good at a glance. Do we have any tests for this? If not, are there any tests you could add? Thanks! |
The gunzip utility is only used by the |
I'm not sure we have any regular contributors to the ESO package at the moment, but that's a good thought. Maybe we can at least make some sort of round-trip test to create, zip, and unzip a file... otherwise we need to come up with some example from ESO that returns a zip. I don't know of any off the top of my head. |
Codecov Report
@@ Coverage Diff @@
## master #1613 +/- ##
==========================================
+ Coverage 62.45% 62.47% +0.02%
==========================================
Files 187 187
Lines 15036 15025 -11
==========================================
- Hits 9390 9387 -3
+ Misses 5646 5638 -8
Continue to review full report at Codecov.
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The best way to deal with files like this is to use tempfile
, which handles file creation/deletion for you in a system-independent way (I think, anyway... at least, it should find a directory where you have write access)
from ..system_tools import gunzip | ||
|
||
def test_gunzip(): | ||
filename = 'test_system_tools.txt.gz' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use tempfile
instead, e.g.:
filehandle = tempfile.NamedTemporaryFile(suffix='.txt.gz')
filename = filehandle.name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty, done!
We just have some minor style fixes (see #1613 (comment) above, which was edited for your last PR) to get travis to go green, then I'll merge |
OK this is weird - @bsipocz , could you have a look? Is this a bug in our configurations, i.e., is pep8 ignoring something that travis isn't? |
There's a travis failure that appears unrelated to this PR. I think this is good to merge, but let's hear from @bsipocz first to see if she has any ideas about the travis install failure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A changelog entry wouldn't hurt. I also have minor comments. I'll address them straight away, so I'll get closer to get that next 0.4 tag out.
astroquery/utils/system_tools.py
Outdated
import shutil | ||
import gzip | ||
|
||
# @EP 09/01/20: system-wide 'gzip' was removed, Python gzip used instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to date/sign comments. The git history/blame is more reliable to trace things back.
""" | ||
|
||
# STDLIB | ||
import gzip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit bike shedding, but now that gzip is assumed to be optional, we need to make sure to skip the test if it's not available.
import tempfile | ||
|
||
# THIRD-PARTY | ||
import pytest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused import.
I'm now a bit confused. Is the python |
The travis failure was unrelated. The one remaining failure will be addressed by #1607 Also, my commit might not be neccessary, but if we revert it, then the imports also need to be moved up to the top of the file, and some more comments removed, too. |
8c2eb21
to
5a1d7a9
Compare
The windows test failure is related, maybe @pllim has some insights. |
Re: Windows -- I think it is the same issue that @astrofrog encountered (and fixed) in astropy/astropy#9874 |
The error is a Permission error on the Windows version of Travis so it doesn't seem related to astropy/astropy#9874 (which was pytest related). Details:
I looked up for Permissions + Windows Travis-cI for for about 40min with no luck. However, I found another ocurrence of tempfile in I re-wrote our test here to use a tempfolder, we'll see if that helps. |
Ended up with a |
The |
@erwanp - could you please rebase? That would get rid of the merge commit, and retrigger CI. (I'm still not certain why the old version of reproject is picked up, rather than the new 0.7) |
3af92b9
to
69f2dc2
Compare
Done, still get the reproject error. |
… it will fix Permission Errors on Travis Windows also added a comment on the 'fz' format
69f2dc2
to
df3475a
Compare
Thank you @erwanp! |
While looking at reading
|
thanks for checking @saimn! Would you mind opening an issue about it? |
Fixes #1538