diff options
author | Victor Stinner <vstinner@python.org> | 2023-11-16 17:57:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 17:57:22 (GMT) |
commit | f66afa395a6d06097ad1ca222ed076e18a7a8126 (patch) | |
tree | f58c3cfca33e77d855499051491c5f5c7144ffa4 | |
parent | 7680da458398c5a08b9c32785b1eeb7b7c0887e4 (diff) | |
download | cpython-f66afa395a6d06097ad1ca222ed076e18a7a8126.zip cpython-f66afa395a6d06097ad1ca222ed076e18a7a8126.tar.gz cpython-f66afa395a6d06097ad1ca222ed076e18a7a8126.tar.bz2 |
gh-111881: Import lazily zipfile in support.script_helper (#112172)
It allows running the test suite when the zlib extension is missing.
-rw-r--r-- | Lib/test/support/script_helper.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py index c2b43f4..7dffe79 100644 --- a/Lib/test/support/script_helper.py +++ b/Lib/test/support/script_helper.py @@ -8,7 +8,6 @@ import os import os.path import subprocess import py_compile -import zipfile from importlib.util import source_from_cache from test import support @@ -226,6 +225,7 @@ def make_script(script_dir, script_basename, source, omit_suffix=False): def make_zip_script(zip_dir, zip_basename, script_name, name_in_zip=None): + import zipfile zip_filename = zip_basename+os.extsep+'zip' zip_name = os.path.join(zip_dir, zip_filename) with zipfile.ZipFile(zip_name, 'w') as zip_file: @@ -252,6 +252,7 @@ def make_pkg(pkg_dir, init_source=''): def make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename, source, depth=1, compiled=False): + import zipfile unlink = [] init_name = make_script(zip_dir, '__init__', '') unlink.append(init_name) |