8000 gh-111881: Import lazily zipfile in support.script_helper (#112172) · python/cpython@f66afa3 · GitHub
[go: up one dir, main page]

Skip to content

Commit f66afa3

Browse files
authored
gh-111881: Import lazily zipfile in support.script_helper (#112172)
It allows running the test suite when the zlib extension is missing.
1 parent 7680da4 commit f66afa3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/test/support/script_helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import os.path
99
import subprocess
1010
import py_compile
11-
import zipfile
1211

1312
from importlib.util import source_from_cache
1413
from test import support
@@ -226,6 +225,7 @@ def make_script(script_dir, script_basename, source, omit_suffix=False):
226225

227226

228227
def make_zip_script(zip_dir, zip_basename, script_name, name_in_zip=None):
228+
import zipfile
229229
zip_filename = zip_basename+os.extsep+'zip'
230230
zip_name = os.path.join(zip_dir, zip_filename)
231231
with zipfile.ZipFile(zip_name, 'w') as zip_file:
@@ -252,6 +252,7 @@ def make_pkg(pkg_dir, init_source=''):
252252

253253
def make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename,
254254
source, depth=1, compiled=False):
255+
import zipfile
255256
unlink = []
256257
init_name = make_script(zip_dir, '__init__', '')
257258
unlink.append(init_name)

0 commit comments

Comments
 (0)
0