Fix test_tarfile failure when gzip is not available

The module would exist, but be empty if already imported.
This change ensures we have gzip available.
This commit is contained in:
Neal Norwitz 2003-04-11 03:05:56 +00:00
parent ffe33b7f24
commit 4ec6824896

View file

@ -923,7 +923,8 @@ def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9):
try:
import gzip
except ImportError:
gzip.GzipFile
except (ImportError, AttributeError):
raise CompressionError, "gzip module is not available"
pre, ext = os.path.splitext(name)