mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Skip test in test_fileinput when zlib is missing.
This commit is contained in:
parent
6b71811469
commit
c3afbb9542
1 changed files with 5 additions and 1 deletions
|
@ -7,7 +7,6 @@ import sys
|
||||||
import re
|
import re
|
||||||
import fileinput
|
import fileinput
|
||||||
import collections
|
import collections
|
||||||
import gzip
|
|
||||||
import types
|
import types
|
||||||
import codecs
|
import codecs
|
||||||
import unittest
|
import unittest
|
||||||
|
@ -16,6 +15,10 @@ try:
|
||||||
import bz2
|
import bz2
|
||||||
except ImportError:
|
except ImportError:
|
||||||
bz2 = None
|
bz2 = None
|
||||||
|
try:
|
||||||
|
import gzip
|
||||||
|
except ImportError:
|
||||||
|
gzip = None
|
||||||
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from fileinput import FileInput, hook_encoded
|
from fileinput import FileInput, hook_encoded
|
||||||
|
@ -758,6 +761,7 @@ class Test_hook_compressed(unittest.TestCase):
|
||||||
def test_no_ext(self):
|
def test_no_ext(self):
|
||||||
self.do_test_use_builtin_open("abcd", 2)
|
self.do_test_use_builtin_open("abcd", 2)
|
||||||
|
|
||||||
|
@unittest.skipUnless(gzip, "Requires gzip and zlib")
|
||||||
def test_gz_ext_fake(self):
|
def test_gz_ext_fake(self):
|
||||||
original_open = gzip.open
|
original_open = gzip.open
|
||||||
gzip.open = self.fake_open
|
gzip.open = self.fake_open
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue