mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
#6026 - fix tests that failed without zlib
This commit is contained in:
parent
21121e64b4
commit
1036a7f7e1
7 changed files with 51 additions and 6 deletions
|
@ -6,11 +6,17 @@ import struct
|
|||
import time
|
||||
import unittest
|
||||
|
||||
import zlib # implied prerequisite
|
||||
from zipfile import ZipFile, ZipInfo, ZIP_STORED, ZIP_DEFLATED
|
||||
from test import test_support
|
||||
from test.test_importhooks import ImportHooksBaseTestCase, test_src, test_co
|
||||
|
||||
# some tests can be ran even without zlib
|
||||
try:
|
||||
import zlib
|
||||
except ImportError:
|
||||
zlib = None
|
||||
|
||||
from zipfile import ZipFile, ZipInfo, ZIP_STORED, ZIP_DEFLATED
|
||||
|
||||
import zipimport
|
||||
import linecache
|
||||
import doctest
|
||||
|
@ -53,6 +59,7 @@ TESTPACK = "ziptestpackage"
|
|||
TESTPACK2 = "ziptestpackage2"
|
||||
TEMP_ZIP = os.path.abspath("junk95142" + os.extsep + "zip")
|
||||
|
||||
|
||||
class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
|
||||
|
||||
compression = ZIP_STORED
|
||||
|
@ -357,7 +364,6 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
|
|||
def testDoctestSuite(self):
|
||||
self.runDoctest(self.doDoctestSuite)
|
||||
|
||||
|
||||
def doTraceback(self, module):
|
||||
try:
|
||||
module.do_raise()
|
||||
|
@ -381,6 +387,7 @@ class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
|
|||
self.doTest(None, files, TESTMOD, call=self.doTraceback)
|
||||
|
||||
|
||||
@unittest.skipUnless(zlib, "requires zlib")
|
||||
class CompressedZipImportTestCase(UncompressedZipImportTestCase):
|
||||
compression = ZIP_DEFLATED
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue