summaryrefslogtreecommitdiff
path: root/Lib/test/test_zipfile64.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_zipfile64.py')
-rw-r--r--Lib/test/test_zipfile64.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/Lib/test/test_zipfile64.py b/Lib/test/test_zipfile64.py
index 0e7d73f1ff..a8fb7aba54 100644
--- a/Lib/test/test_zipfile64.py
+++ b/Lib/test/test_zipfile64.py
@@ -11,12 +11,6 @@ support.requires(
'test requires loads of disk-space bytes and a long time to run'
)
-# We can test part of the module without zlib.
-try:
- import zlib
-except ImportError:
- zlib = None
-
import zipfile, os, unittest
import time
import sys
@@ -24,7 +18,7 @@ import sys
from io import StringIO
from tempfile import TemporaryFile
-from test.support import TESTFN, run_unittest
+from test.support import TESTFN, run_unittest, requires_zlib
TESTFN2 = TESTFN + "2"
@@ -81,12 +75,12 @@ class TestsWithSourceFile(unittest.TestCase):
for f in TemporaryFile(), TESTFN2:
self.zipTest(f, zipfile.ZIP_STORED)
- if zlib:
- def testDeflated(self):
- # Try the temp file first. If we do TESTFN2 first, then it hogs
- # gigabytes of disk space for the duration of the test.
- for f in TemporaryFile(), TESTFN2:
- self.zipTest(f, zipfile.ZIP_DEFLATED)
+ @requires_zlib
+ def testDeflated(self):
+ # Try the temp file first. If we do TESTFN2 first, then it hogs
+ # gigabytes of disk space for the duration of the test.
+ for f in TemporaryFile(), TESTFN2:
+ self.zipTest(f, zipfile.ZIP_DEFLATED)
def tearDown(self):
for fname in TESTFN, TESTFN2: