diff --git a/astroquery/utils/system_tools.py b/astroquery/utils/system_tools.py index 220306bfea..09c98685bb 100644 --- a/astroquery/utils/system_tools.py +++ b/astroquery/utils/system_tools.py @@ -1,33 +1,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -import gzip import os -import shutil - - -def gunzip(filename): - """ Decompress a file with gzip. - - Parameters - ---------- - filename : str - Fully qualified path of the file to decompress. - - Returns - ------- - filename : str - Name of the decompressed file (or input filename if gzip is not - available). - """ - - # ".fz" denotes RICE rather than gzip compression - if not filename.endswith('.fz'): - with gzip.open(filename, 'rb') as f_in: - with open(filename.rsplit(".", 1)[0], 'wb') as f_out: - shutil.copyfileobj(f_in, f_out) - return filename.rsplit(".", 1)[0] - else: - return filename # If there is an update issue of astropy#2793 that got merged, this should diff --git a/astroquery/utils/tests/test_system_tools.py b/astroquery/utils/tests/test_system_tools.py deleted file mode 100644 index 32e98d6e58..0000000000 --- a/astroquery/utils/tests/test_system_tools.py +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed under a 3-clause BSD style license - see LICENSE.rst - -import gzip - -from ..system_tools import gunzip - - -def test_gunzip(tmp_path): - filename = tmp_path / 'test_gunzip.txt.gz' - # First create a gzip file - content = b"Bla" - with gzip.open(filename, "wb") as f: - f.write(content) - # Then test our gunzip command works - gunzip(str(filename)) - with open(filename.with_suffix(''), "rb") as f: - new_content = f.read() - assert new_content == content