From: Ezio Melotti Date: Sat, 14 May 2011 07:10:53 +0000 (+0300) Subject: Skip test in test_fileinput when zlib is missing. X-Git-Tag: v3.3.0a1~2281 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c3afbb95425b42de348ec4b0430f954a37d6ce20;p=python Skip test in test_fileinput when zlib is missing. --- diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index 76e4d16841..a96d48a561 100644 --- a/Lib/test/test_fileinput.py +++ b/Lib/test/test_fileinput.py @@ -7,7 +7,6 @@ import sys import re import fileinput import collections -import gzip import types import codecs import unittest @@ -16,6 +15,10 @@ try: import bz2 except ImportError: bz2 = None +try: + import gzip +except ImportError: + gzip = None from io import StringIO from fileinput import FileInput, hook_encoded @@ -758,6 +761,7 @@ class Test_hook_compressed(unittest.TestCase): def test_no_ext(self): self.do_test_use_builtin_open("abcd", 2) + @unittest.skipUnless(gzip, "Requires gzip and zlib") def test_gz_ext_fake(self): original_open = gzip.open gzip.open = self.fake_open