Skip to content

test.test_tools.test_freeze.TestFreeze.test_freeze_simple_script fails when running test suite locally without zlib #91752

Closed
@AbhigyanBose

Description

@AbhigyanBose

Bug report

When running test suite locally without zlib, test.test_tools.test_freeze.TestFreeze.test_freeze_simple_script fails, expected behavior is for the test to be skipped.

This test is skipped when using a buildbot due to the line:
@support.skip_if_buildbot('not all buildbots have enough space')

Your environment
Fresh install of Ubuntu 20.04 followed up update. Executed the following to install build tools:
sudo apt install build-essential

Command used to run tests:
./python -m test -v test_tools

Error message:

changing mode of /tmp/tmpa7jc0cg_/python-installation/lib/python3.11/lib-dynload/__pycache__ to 755
Traceback (most recent call last):
  File "<frozen zipimport>", line 570, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen zipimport>", line 618, in _get_data
  File "<frozen zipimport>", line 573, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 6, in <module>
  File "<frozen runpy>", line 207, in run_module
  File "<frozen runpy>", line 148, in _get_module_details
  File "<frozen runpy>", line 112, in _get_module_details
  File "<frozen zipimport>", line 196, in get_code
  File "<frozen zipimport>", line 752, in _get_module_code
  File "<frozen zipimport>", line 620, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/tmp/tmpa7jc0cg_/cpython/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
             ^^^^^^^^^^^^^^^^^
  File "/tmp/tmpa7jc0cg_/cpython/Lib/ensurepip/__init__.py", line 276, in _main
    return _bootstrap(
           ^^^^^^^^^^^
  File "/tmp/tmpa7jc0cg_/cpython/Lib/ensurepip/__init__.py", line 192, in _bootstrap
    return _run_pip([*args, *_PACKAGE_NAMES], additional_paths)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmpa7jc0cg_/cpython/Lib/ensurepip/__init__.py", line 92, in _run_pip
    return subprocess.run([sys.executable, '-W', 'ignore::DeprecationWarning',
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/tmpa7jc0cg_/cpython/Lib/subprocess.py", line 535, in run
    raise CalledProcessError(retcode, process.args,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subprocess.CalledProcessError: Command '['/tmp/tmpa7jc0cg_/python-build/python', '-W', 'ignore::DeprecationWarning', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmpf9yxt3r4/setuptools-58.1.0-py3-none-any.whl\', \'/tmp/tmpf9yxt3r4/pip-22.0.4-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmpf9yxt3r4\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1824: install] Error 1

---- END ----
ERROR

some more output in between

test_sundry_windows (test.test_tools.test_sundry.TestSundryScripts.test_sundry_windows) ... skipped 'Windows-only test'

======================================================================
ERROR: test_freeze_simple_script (test.test_tools.test_freeze.TestFreeze.test_freeze_simple_script)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/abhigyan/Documents/cpython/Lib/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/abhigyan/Documents/cpython/Lib/test/support/os_helper.py", line 396, in temp_dir
    yield path
    ^^^^^^^^^^
  File "/home/abhigyan/Documents/cpython/Lib/test/test_tools/test_freeze.py", line 27, in test_freeze_simple_script
    outdir, scriptfile, python = helper.prepare(script, outdir)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/abhigyan/Documents/cpython/Tools/freeze/test/freeze.py", line 163, in prepare
    _run_quiet([MAKE, '-C', builddir, '-j8', 'install'])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/abhigyan/Documents/cpython/Tools/freeze/test/freeze.py", line 25, in _run_quiet
    return subprocess.run(
           ^^^^^^^^^^^^^^^
  File "/home/abhigyan/Documents/cpython/Lib/subprocess.py", line 535, in run
    raise CalledProcessError(retcode, process.args,
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
subprocess.CalledProcessError: Command '['/usr/bin/make', '-C', '/tmp/tmpa7jc0cg_/python-build', '-j8', 'install']' returned non-zero exit status 2.

----------------------------------------------------------------------
Ran 61 tests in 86.200s

FAILED (errors=1, skipped=1)
test_tools failed (1 error) in 1 min 26 sec

== Tests result: FAILURE ==

1 test failed:
    test_tools

Total duration: 1 min 26 sec
Tests result: FAILURE

Complete test output is attached below.

CPython versions tested on:

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions