Skip to content

test_(zipfile|zipimport|gzip|distutils|sqlite) fail if zlib is not available #50276

Closed

Description

@ezio-melotti
BPO 6026
Nosy @amauryfa, @ezio-melotti
Files
  • issue6026.diff: Patch against the trunk for test_(zipfile
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ezio-melotti'
    closed_at = <Date 2009-09-12.18:46:50.823>
    created_at = <Date 2009-05-15.00:58:24.739>
    labels = ['type-bug', 'tests']
    title = 'test_(zipfile|zipimport|gzip|distutils|sqlite) fail if zlib is not available'
    updated_at = <Date 2010-07-12.21:17:49.364>
    user = 'https://github.com/ezio-melotti'

    bugs.python.org fields:

    activity = <Date 2010-07-12.21:17:49.364>
    actor = 'amfarrell'
    assignee = 'ezio.melotti'
    closed = True
    closed_date = <Date 2009-09-12.18:46:50.823>
    closer = 'ezio.melotti'
    components = ['Tests']
    creation = <Date 2009-05-15.00:58:24.739>
    creator = 'ezio.melotti'
    dependencies = []
    files = ['14512', '14524']
    hgrepos = []
    issue_num = 6026
    keywords = []
    message_count = 14.0
    messages = ['87783', '89999', '90002', '90003', '90597', '90602', '90716', '91927', '92551', '110123', '110128', '110132', '110138', '110141']
    nosy_count = 4.0
    nosy_names = ['amaury.forgeotdarc', 'ezio.melotti', 'nicdumz', 'amfarrell']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue6026'
    versions = ['Python 3.1', 'Python 2.7']

    Activity

    1. ezio-melotti commented on May 15, 2009

      @ezio-melotti
      MemberAuthor

      Python build finished, but the necessary bits to build these modules
      were not found: _dbm _gdbm _hashlib _sqlite3 _ssl _tkinter bz2 zlib

      When zlib is missing some tests fail:

      ./python -m test.regrtest -uall -v test_zipimport
      Could not find '/home/wolf/py3k/Lib/test' in sys.path to remove it
      test_zipimport
      test test_zipimport crashed -- <class 'ImportError'>: No module named zlib
      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/test/regrtest.py", line 613, in runtest_inner
          the_package = __import__(abstest, globals(), locals(), [])
        File "/home/wolf/py3k/Lib/test/test_zipimport.py", line 9, in <module>
          import zlib # implied prerequisite
      ImportError: No module named zlib
      1 test failed:
          test_zipimport

      ./python -m test.regrtest -uall -v test_zipfile
      Could not find '/home/wolf/py3k/Lib/test' in sys.path to remove it
      test_zipfile
      testAbsoluteArcnames (test.test_zipfile.TestsWithSourceFile) ... ok
      [...]

      ======================================================================
      ERROR: test_PerFileCompression (test.test_zipfile.TestsWithSourceFile)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/test/test_zipfile.py", line 300, in
      test_PerFileCompression
          zipfp.write(TESTFN, 'deflateme', zipfile.ZIP_DEFLATED)
        File "/home/wolf/py3k/Lib/zipfile.py", line 1045, in write
          self._writecheck(zinfo)
        File "/home/wolf/py3k/Lib/zipfile.py", line 1004, in _writecheck
          "Compression requires the (missing) zlib module")
      RuntimeError: Compression requires the (missing) zlib module
       

      ======================================================================
      ERROR: testGoodPassword (test.test_zipfile.DecryptionTests)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/test/test_zipfile.py", line 856, in
      testGoodPassword
          self.assertEquals(self.zip2.read("zero"), self.plain2)
        File "/home/wolf/py3k/Lib/zipfile.py", line 850, in read
          return self.open(name, "r", pwd).read()
        File "/home/wolf/py3k/Lib/zipfile.py", line 923, in open
          zef = ZipExtFile(zef_file, zinfo, zd)
        File "/home/wolf/py3k/Lib/zipfile.py", line 470, in __init__
          self.dc = zlib.decompressobj(-15)
      AttributeError: 'NoneType' object has no attribute 'decompressobj'
       

      ======================================================================
      ERROR: testDifferentFile (test.test_zipfile.TestsWithMultipleOpens)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/test/test_zipfile.py", line 955, in setUp
          zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_DEFLATED)
        File "/home/wolf/py3k/Lib/zipfile.py", line 669, in __init__
          "Compression requires the (missing) zlib module")
      RuntimeError: Compression requires the (missing) zlib module
       

      ======================================================================
      ERROR: testInterleaved (test.test_zipfile.TestsWithMultipleOpens)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/test/test_zipfile.py", line 955, in setUp
          zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_DEFLATED)
        File "/home/wolf/py3k/Lib/zipfile.py", line 669, in __init__
          "Compression requires the (missing) zlib module")
      RuntimeError: Compression requires the (missing) zlib module
       

      ======================================================================
      ERROR: testSameFile (test.test_zipfile.TestsWithMultipleOpens)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/test/test_zipfile.py", line 955, in setUp
          zipfp = zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_DEFLATED)
        File "/home/wolf/py3k/Lib/zipfile.py", line 669, in __init__
          "Compression requires the (missing) zlib module")
      RuntimeError: Compression requires the (missing) zlib module
       

      Ran 53 tests in 1.292s

      FAILED (errors=5)
      test test_zipfile failed -- errors occurred; run in verbose mode for details
      1 test failed:
      test_zipfile

      ./python -m test.regrtest -uall -v test_gzip
      Could not find '/home/wolf/py3k/Lib/test' in sys.path to remove it
      test_gzip
      test test_gzip crashed -- <class 'ImportError'>: No module named zlib
      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/test/regrtest.py", line 613, in runtest_inner
          the_package = __import__(abstest, globals(), locals(), [])
        File "/home/wolf/py3k/Lib/test/test_gzip.py", line 8, in <module>
          import gzip
        File "/home/wolf/py3k/Lib/gzip.py", line 9, in <module>
          import zlib
      ImportError: No module named zlib
      1 test failed:
          test_gzip

      ./python -m test.regrtest -uall -v test_distutils
      Could not find '/home/wolf/py3k/Lib/test' in sys.path to remove it
      test_distutils
      test_check_all (distutils.tests.test_check.CheckTestCase) ... ok
      [...]

      ======================================================================
      ERROR: test_simple_built (distutils.tests.test_bdist_dumb.BuildDumbTestCase)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/distutils/tests/test_bdist_dumb.py", line
      62, in test_simple_built
          cmd.run()
        File "/home/wolf/py3k/Lib/distutils/command/bdist_dumb.py", line 111,
      in run
          self.format, root_dir=archive_root)
        File "/home/wolf/py3k/Lib/distutils/cmd.py", line 372, in make_archive
          dry_run=self.dry_run)
        File "/home/wolf/py3k/Lib/distutils/archive_util.py", line 160, in
      make_archive
          filename = func(base_name, base_dir, **kwargs)
        File "/home/wolf/py3k/Lib/distutils/archive_util.py", line 97, in
      make_zipfile
          compression=zipfile.ZIP_DEFLATED)
        File "/home/wolf/py3k/Lib/zipfile.py", line 669, in __init__
          "Compression requires the (missing) zlib module")
      RuntimeError: Compression requires the (missing) zlib module
       

      ======================================================================
      ERROR: test_add_defaults (distutils.tests.test_sdist.sdistTestCase)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/distutils/tests/test_sdist.py", line 193, in
      test_add_defaults
          cmd.run()
        File "/home/wolf/py3k/Lib/distutils/command/sdist.py", line 150, in run
          self.make_distribution()
        File "/home/wolf/py3k/Lib/distutils/command/sdist.py", line 464, in
      make_distribution
          file = self.make_archive(base_name, fmt, base_dir=base_dir)
        File "/home/wolf/py3k/Lib/distutils/cmd.py", line 372, in make_archive
          dry_run=self.dry_run)
        File "/home/wolf/py3k/Lib/distutils/archive_util.py", line 160, in
      make_archive
          filename = func(base_name, base_dir, **kwargs)
        File "/home/wolf/py3k/Lib/distutils/archive_util.py", line 97, in
      make_zipfile
          compression=zipfile.ZIP_DEFLATED)
        File "/home/wolf/py3k/Lib/zipfile.py", line 669, in __init__
          "Compression requires the (missing) zlib module")
      RuntimeError: Compression requires the (missing) zlib module
       

      ======================================================================
      ERROR: test_prune_file_list (distutils.tests.test_sdist.sdistTestCase)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/wolf/py3k/Lib/distutils/tests/test_sdist.py", line 100, in
      test_prune_file_list
          cmd.run()
        File "/home/wolf/py3k/Lib/distutils/command/sdist.py", line 150, in run
          self.make_distribution()
        File "/home/wolf/py3k/Lib/distutils/command/sdist.py", line 464, in
      make_distribution
          file = self.make_archive(base_name, fmt, base_dir=base_dir)
        File "/home/wolf/py3k/Lib/distutils/cmd.py", line 372, in make_archive
          dry_run=self.dry_run)
        File "/home/wolf/py3k/Lib/distutils/archive_util.py", line 160, in
      make_archive
          filename = func(base_name, base_dir, **kwargs)
        File "/home/wolf/py3k/Lib/distutils/archive_util.py", line 97, in
      make_zipfile
          compression=zipfile.ZIP_DEFLATED)
        File "/home/wolf/py3k/Lib/zipfile.py", line 669, in __init__
          "Compression requires the (missing) zlib module")
      RuntimeError: Compression requires the (missing) zlib module
       

      Ran 108 tests in 0.739s

      FAILED (errors=3)
      test test_distutils failed -- errors occurred; run in verbose mode for
      details
      1 test failed:
      test_distutils

      Should these tests be skipped instead?

    2. added
      testsTests in the Lib/test dir
      type-bugAn unexpected behavior, bug, or error
      on May 15, 2009
    3. ezio-melotti commented on Jul 1, 2009

      @ezio-melotti
      MemberAuthor

      I tried also with the final release of Python 3.1, but when zlib is
      missing only test_zlib is skipped, test_zipfile, test_zipimport,
      test_gzip and test_distutils fail.
      These tests should check if zlib is available too.

    4. self-assigned this
      on Jul 2, 2009
    5. amauryfa commented on Jul 2, 2009

      @amauryfa
      Contributor

      test_zipfile and test_zipimport should be enabled when zlib is not
      available: a zip file can store data uncompressed, and does not need
      zlib in this case.
      Only disable tests that require compression.

    6. ezio-melotti commented on Jul 2, 2009

      @ezio-melotti
      MemberAuthor

      I'm working on a patch.
      There a few more tests that need to be skipped in test_zipfile when zlib
      is not available. test_gzip has to be skipped entirely if zlib is not
      available. I still have to look at test_zipimport and test_distutils.

    7. ezio-melotti commented on Jul 17, 2009

      @ezio-melotti
      MemberAuthor

      Now (Python2.7a0 trunk:74029) there are 3 more tests that fail because
      zlib is not available: test_multiprocessing, test_xmlrpc and test_docxmlrpc.

    8. changed the title [-]test_(zipfile|zipimport|gzip|distutils) fail if zlib is not available[/-] [+]test_(zipfile|zipimport|gzip|distutils|multiprocessing|xmlrpc|docxmlrpc) fail if zlib is not available[/+] on Jul 17, 2009
    9. ezio-melotti commented on Jul 17, 2009

      @ezio-melotti
      MemberAuthor

      The 3 new failures (test_multiprocessing, test_xmplrpc and
      test_docxmlrpc) were introduced in r73638 and I opened a new issue about
      that (bpo-6499). I'll wait to see if and how they should be fixed (and
      possibly open a new issue for them).

      The attached patch fixes test_zipfile, test_zipimport, test_gzip and
      test_distutils.

      I used two techniques to fix these files:

      1. checking if zlib was available with
        try:
        import zlib
        except ImportError:
        zlib = None
        and then using @skipUnless(zlib, "requires zlib")
        to skip individual tests/classes
      2. using zlib = test_support.import_module('zlib') when
        zlib (or other modules like gzip) was necessary for
        all the tests

      The patch includes the following fixes:

      In test_zipfile there were 5 tests that were failing. Several other
      tests work without zlib too. Fixed adding 3 @skipUnless(zlib, "requires
      zlib") to two methods and to the TestsWithMultipleOpens class.

      In test_zipimport there are 3 test classes. The 3rd class tests various
      errors that are raised when, for example, the file doesn't exists. This
      class works without zlib too, but since it's pointless to run it if the
      other two don't work I decided to skip everything. Fixed adding zlib =
      test_support.import_module('zlib').

      In test_gzip all the files require gzip to work, and gzip requires zlib.
      Fixed adding gzip = test_support.import_module('gzip').

      In test_distutils there are several files affected:
      test_sdist: fixed with 4 @skipUnless(zlib, "requires zlib")
      test_bdist_dumb: fixed with a @skipUnless(zlib, "requires zlib")
      test_archive_util: fixed with 3 @skipUnless(zlib, "requires zlib")

      If the patch is good I'll commit it.

    10. ezio-melotti commented on Jul 20, 2009

      @ezio-melotti
      MemberAuthor

      Here's a new patch.

      I added a could of @skipUnless in test_sqlite because two tests were
      failing.
      I couldn't notice this before because I didn't have _sqlite3 and these
      tests were skipped. Thanks to R. David Murray for reporting the problem.

      In test_zipimport, the tests in 2/3 of the classes can be executed when
      zlib is missing (and not only 1/3 as I initially thought). Removed zlib
      = test_support.import_module('zlib') and added a @skipUnless(zlib,
      "requires zlib"). Thanks again to David for this.

      test_multiprocessing, test_xmplrpc and test_docxmlrpc were fixed in
      bpo-6499, so they are not part of this issue anymore.

    11. changed the title [-]test_(zipfile|zipimport|gzip|distutils|multiprocessing|xmlrpc|docxmlrpc) fail if zlib is not available[/-] [+]test_(zipfile|zipimport|gzip|distutils|sqlite) fail if zlib is not available[/+] on Jul 20, 2009
    12. nicdumz commented on Aug 24, 2009

      nicdumzmannequin
      Mannequin

      Great, I don't know how I missed that bug.

      It looks really similar to the patch I had written at
      http://codereview.appspot.com/111041

      So your patch looks correct to me, and does solve the issue locally.

    13. ezio-melotti commented on Sep 12, 2009

      @ezio-melotti
      MemberAuthor

      Fixed in r74754 (trunk) and r74755 (py3k).

    14. amfarrell commented on Jul 12, 2010

      amfarrellmannequin
      Mannequin

      In the midst of installing from
      http://www.python.org/ftp/python/2.7/Python-2.7.tgz
      I get this same error on test_distutils when I run make test.

      this is on debian lenny, amd64

      distutils_test output:
      =================================================
      afarrell:~/Python-2.7$ ./python Lib/test/regrtest.py -v test_distutils== CPython 2.7 (r27:82500, Jul 12 2010, 13:29:51) [GCC 4.3.2]
      == Linux-2.6.26-2-amd64-x86_64-with-debian-5.0.5 little-endian
      == /home/afarrell/Python-2.7/build/test_python_26242
      test_distutils
      test_byte_compile (distutils.tests.test_install_lib.InstallLibTestCase) ... ok
      test_dont_write_bytecode (distutils.tests.test_install_lib.InstallLibTestCase) ... ok
      test_finalize_options (distutils.tests.test_install_lib.InstallLibTestCase) ... ok
      test_get_inputs (distutils.tests.test_install_lib.InstallLibTestCase) ... ok
      test_get_outputs (distutils.tests.test_install_lib.InstallLibTestCase) ... ok
      test_clean (distutils.tests.test_config_cmd.ConfigTestCase) ... ok
      test_dump_file (distutils.tests.test_config_cmd.ConfigTestCase) ... ok
      test_finalize_options (distutils.tests.test_config_cmd.ConfigTestCase) ... ok
      test_search_cpp (distutils.tests.test_config_cmd.ConfigTestCase) ... ok
      test_check_all (distutils.tests.test_check.CheckTestCase) ... ok
      test_check_document (distutils.tests.test_check.CheckTestCase) ... ok
      test_check_metadata (distutils.tests.test_check.CheckTestCase) ... ok
      test_check_restructuredtext (distutils.tests.test_check.CheckTestCase) ... ok
      test_newer (distutils.tests.test_dep_util.DepUtilTestCase) ... ok
      test_newer_group (distutils.tests.test_dep_util.DepUtilTestCase) ... ok
      test_newer_pairwise (distutils.tests.test_dep_util.DepUtilTestCase) ... ok
      test_runtime_libdir_option (distutils.tests.test_unixccompiler.UnixCCompilerTestCase) ... ok
      VersionPredicate (distutils.versionpredicate)
      Doctest: distutils.versionpredicate.VersionPredicate ... ok
      split_provision (distutils.versionpredicate)
      Doctest: distutils.versionpredicate.split_provision ... ok
      test_server_empty_registration (distutils.tests.test_config.PyPIRCCommandTestCase) ... ok
      test_server_registration (distutils.tests.test_config.PyPIRCCommandTestCase) ... ok
      test_debug_print (distutils.tests.test_filelist.FileListTestCase) ... ok
      test_glob_to_re (distutils.tests.test_filelist.FileListTestCase) ... ok
      test_process_template_line (distutils.tests.test_filelist.FileListTestCase) ... ok
      test_default_settings (distutils.tests.test_install_scripts.InstallScriptsTestCase) ... ok
      test_installation (distutils.tests.test_install_scripts.InstallScriptsTestCase) ... ok
      test_finalize_options (distutils.tests.test_build.BuildTestCase) ... ok
      test_check_archive_formats (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... ok
      test_compress_deprecated (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... skipped 'The compress program is required'
      test_make_archive (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... ok
      test_make_archive_cwd (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... ok
      test_make_archive_owner_group (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... skipped 'Requires zlib'
      test_make_tarball (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... skipped 'requires zlib'
      test_make_zipfile (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... skipped 'Requires zlib'
      test_tarfile_root_owner (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... skipped 'Requires zlib'
      test_tarfile_vs_tar (distutils.tests.test_archive_util.ArchiveUtilTestCase) ... skipped 'Requires zlib'
      test_formats (distutils.tests.test_bdist.BuildTestCase) ... ok
      test_build_ext (distutils.tests.test_build_ext.BuildExtTestCase) ... skipped 'xxmodule.c not found'
      test_build_ext_inplace (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_build_ext_path_cross_platform (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_build_ext_path_with_os_sep (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_check_extensions_list (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_compiler_option (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_ext_fullpath (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_finalize_options (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_get_source_files (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_setuptools_compat (distutils.tests.test_build_ext.BuildExtTestCase) ... skipped 'No module named setuptools_build_ext'
      test_solaris_enable_shared (distutils.tests.test_build_ext.BuildExtTestCase) ... ok
      test_no_optimize_flag (distutils.tests.test_bdist_rpm.BuildRpmTestCase) ... ok
      test_quiet (distutils.tests.test_bdist_rpm.BuildRpmTestCase) ... ok
      test_finalize_options (distutils.tests.test_upload.uploadTestCase) ... ok
      test_saved_password (distutils.tests.test_upload.uploadTestCase) ... ok
      test_server_empty_registration (distutils.tests.test_upload.uploadTestCase) ... ok
      test_server_registration (distutils.tests.test_upload.uploadTestCase) ... ok
      test_upload (distutils.tests.test_upload.uploadTestCase) ... ok
      test_class (distutils.tests.test_text_file.TextFileTestCase) ... ok
      test_home_installation_scheme (distutils.tests.test_install.InstallTestCase) ... ok
      test_simple_run (distutils.tests.test_install_data.InstallDataTestCase) ... ok
      test_simple_run (distutils.tests.test_clean.cleanTestCase) ... ok
      test_announce (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_command_packages_cmdline (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_command_packages_configfile (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_command_packages_unspecified (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_debug_mode (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_empty_options (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_finalize_options (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_find_config_files_disable (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_get_command_packages (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_write_pkg_file (distutils.tests.test_dist.DistributionTestCase) ... ok
      test_custom_pydistutils (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_fix_help_options (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_long_description (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_obsoletes (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_obsoletes_illegal (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_provides (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_provides_illegal (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_read_metadata (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_requires (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_requires_illegal (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_show_help (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_simple_metadata (distutils.tests.test_dist.MetadataTestCase) ... ok
      test_get_exe_bytes (distutils.tests.test_bdist_wininst.BuildWinInstTestCase) ... ok
      test_cmp (distutils.tests.test_version.VersionTestCase) ... ok
      test_cmp_strict (distutils.tests.test_version.VersionTestCase) ... ok
      test_prerelease (distutils.tests.test_version.VersionTestCase) ... ok
      test_customize_compiler (distutils.tests.test_ccompiler.CCompilerTestCase) ... ok
      test_debug_print (distutils.tests.test_ccompiler.CCompilerTestCase) ... ok
      test_gen_lib_options (distutils.tests.test_ccompiler.CCompilerTestCase) ... ok
      test_minial (distutils.tests.test_bdist_msi.BDistMSITestCase) ... skipped 'These tests are only for win32'
      test_debug_print (distutils.tests.test_cmd.CommandTestCase) ... ok
      test_dump_options (distutils.tests.test_cmd.CommandTestCase) ... ok
      test_ensure_dirname (distutils.tests.test_cmd.CommandTestCase) ... ok
      test_ensure_filename (distutils.tests.test_cmd.CommandTestCase) ... ok
      test_ensure_string (distutils.tests.test_cmd.CommandTestCase) ... ok
      test_ensure_string_list (distutils.tests.test_cmd.CommandTestCase) ... ok
      test_make_file (distutils.tests.test_cmd.CommandTestCase) ... ok
      test_nt_quote_args (distutils.tests.test_spawn.SpawnTestCase) ... ok
      test_spawn (distutils.tests.test_spawn.SpawnTestCase) ... ok
      test_copy_tree_verbosity (distutils.tests.test_dir_util.DirUtilTestCase) ... ok
      test_create_tree_verbosity (distutils.tests.test_dir_util.DirUtilTestCase) ... ok
      test_ensure_relative (distutils.tests.test_dir_util.DirUtilTestCase) ... ok
      test_mkpath_remove_tree_verbosity (distutils.tests.test_dir_util.DirUtilTestCase) ... ok
      test_dont_write_bytecode (distutils.tests.test_util.UtilTestCase) ... ok
      test_check_metadata_deprecated (distutils.tests.test_register.RegisterTestCase) ... ok
      test_create_pypirc (distutils.tests.test_register.RegisterTestCase) ... ok
      test_password_not_in_file (distutils.tests.test_register.RegisterTestCase) ... ok
      test_password_reset (distutils.tests.test_register.RegisterTestCase) ... ok
      test_registering (distutils.tests.test_register.RegisterTestCase) ... ok
      test_server_empty_registration (distutils.tests.test_register.RegisterTestCase) ... ok
      test_server_registration (distutils.tests.test_register.RegisterTestCase) ... ok
      test_strict (distutils.tests.test_register.RegisterTestCase) ... ok
      test_debug_mode (distutils.tests.test_core.CoreTestCase) ... ok
      test_run_setup_provides_file (distutils.tests.test_core.CoreTestCase) ... ok
      test_run_setup_uses_current_dir (distutils.tests.test_core.CoreTestCase) ... ok
      test_build (distutils.tests.test_build_scripts.BuildScriptsTestCase) ... ok
      test_default_settings (distutils.tests.test_build_scripts.BuildScriptsTestCase) ... ok
      test_version_int (distutils.tests.test_build_scripts.BuildScriptsTestCase) ... ok
      test_simple_run (distutils.tests.test_install_headers.InstallHeadersTestCase) ... ok
      test_finalize_options (distutils.tests.test_bdist_dumb.BuildDumbTestCase) ... ok
      test_simple_built (distutils.tests.test_bdist_dumb.BuildDumbTestCase) ... skipped 'requires zlib'
      test_copy_file (distutils.tests.test_file_util.FileUtilTestCase) ... ok
      test_move_file_verbosity (distutils.tests.test_file_util.FileUtilTestCase) ... ok
      test_write_file (distutils.tests.test_file_util.FileUtilTestCase) ... ok
      test_dont_write_bytecode (distutils.tests.test_build_py.BuildPyTestCase) ... ok
      test_empty_package_dir (distutils.tests.test_build_py.BuildPyTestCase) ... ok
      test_package_data (distutils.tests.test_build_py.BuildPyTestCase) ... ok
      test_package_data_pyc (distutils.tests.test_build_py.BuildPyTestCase) ... ok
      test_no_compiler (distutils.tests.test_msvc9compiler.msvc9compilerTestCase) ... skipped 'These tests are only for win32'
      test_reg_class (distutils.tests.test_msvc9compiler.msvc9compilerTestCase) ... skipped 'These tests are only for win32'
      test_remove_visual_c_ref (distutils.tests.test_msvc9compiler.msvc9compilerTestCase) ... skipped 'These tests are only for win32'
      test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ... ok
      test_get_python_lib (distutils.tests.test_sysconfig.SysconfigTestCase) ... ok
      test_parse_makefile_base (distutils.tests.test_sysconfig.SysconfigTestCase) ... ok
      test_parse_makefile_literal_dollar (distutils.tests.test_sysconfig.SysconfigTestCase) ... ok
      test_add_defaults (distutils.tests.test_sdist.SDistTestCase) ... skipped 'requires zlib'
      test_check_metadata_deprecated (distutils.tests.test_sdist.SDistTestCase) ... ok
      test_finalize_options (distutils.tests.test_sdist.SDistTestCase) ... ok
      test_get_file_list (distutils.tests.test_sdist.SDistTestCase) ... ERROR
      Exception AttributeError: "_Stream instance has no attribute 'cmp'" in <bound method _Stream.__del__ of <tarfile._Stream instance at 0x100cb48>> ignored
      test_make_distribution (distutils.tests.test_sdist.SDistTestCase) ... skipped 'requires zlib'
      test_make_distribution_owner_group (distutils.tests.test_sdist.SDistTestCase) ... skipped 'requires zlib'
      test_metadata_check_option (distutils.tests.test_sdist.SDistTestCase) ... skipped 'requires zlib'
      test_prune_file_list (distutils.tests.test_sdist.SDistTestCase) ... skipped 'requires zlib'
      test_server_empty_registration (distutils.tests.test_sdist.SDistTestCase) ... ok
      test_server_registration (distutils.tests.test_sdist.SDistTestCase) ... ok
      test_show_formats (distutils.tests.test_sdist.SDistTestCase) ... ok
      test_build_libraries (distutils.tests.test_build_clib.BuildCLibTestCase) ... ok
      test_check_library_dist (distutils.tests.test_build_clib.BuildCLibTestCase) ... ok
      test_finalize_options (distutils.tests.test_build_clib.BuildCLibTestCase) ... ok
      test_get_source_files (distutils.tests.test_build_clib.BuildCLibTestCase) ... ok
      test_run (distutils.tests.test_build_clib.BuildCLibTestCase) ... ok

      ======================================================================
      ERROR: test_get_file_list (distutils.tests.test_sdist.SDistTestCase)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "/home/afarrell/Python-2.7/Lib/distutils/tests/test_sdist.py", line 357, in test_get_file_list
          cmd.run()
        File "/home/afarrell/Python-2.7/Lib/distutils/command/sdist.py", line 168, in run
          self.make_distribution()
        File "/home/afarrell/Python-2.7/Lib/distutils/command/sdist.py", line 435, in make_distribution
          owner=self.owner, group=self.group)
        File "/home/afarrell/Python-2.7/Lib/distutils/cmd.py", line 392, in make_archive
          owner=owner, group=group)
        File "/home/afarrell/Python-2.7/Lib/distutils/archive_util.py", line 237, in make_archive
          filename = func(base_name, base_dir, **kwargs)
        File "/home/afarrell/Python-2.7/Lib/distutils/archive_util.py", line 101, in make_tarball
          tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress])
        File "/home/afarrell/Python-2.7/Lib/tarfile.py", line 1687, in open
          _Stream(name, filemode, comptype, fileobj, bufsize),
        File "/home/afarrell/Python-2.7/Lib/tarfile.py", line 425, in __init__
          raise CompressionError("zlib module is not available")
      CompressionError: zlib module is not available

      Ran 151 tests in 0.439s

      FAILED (errors=1, skipped=18)
      test test_distutils failed -- Traceback (most recent call last):
        File "/home/afarrell/Python-2.7/Lib/distutils/tests/test_sdist.py", line 357, in test_get_file_list
          cmd.run()
        File "/home/afarrell/Python-2.7/Lib/distutils/command/sdist.py", line 168, in run
          self.make_distribution()
        File "/home/afarrell/Python-2.7/Lib/distutils/command/sdist.py", line 435, in make_distribution
          owner=self.owner, group=self.group)
        File "/home/afarrell/Python-2.7/Lib/distutils/cmd.py", line 392, in make_archive
          owner=owner, group=group)
        File "/home/afarrell/Python-2.7/Lib/distutils/archive_util.py", line 237, in make_archive
          filename = func(base_name, base_dir, **kwargs)
        File "/home/afarrell/Python-2.7/Lib/distutils/archive_util.py", line 101, in make_tarball
          tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress])
        File "/home/afarrell/Python-2.7/Lib/tarfile.py", line 1687, in open
          _Stream(name, filemode, comptype, fileobj, bufsize),
        File "/home/afarrell/Python-2.7/Lib/tarfile.py", line 425, in __init__
          raise CompressionError("zlib module is not available")
      CompressionError: zlib module is not available

      1 test failed:
      test_distutils

    15. ezio-melotti commented on Jul 12, 2010

      @ezio-melotti
      MemberAuthor

      Thanks for the report, fixed in r82839 (py3k), r82840 (release27-maint), and r82841 (release31-maint).

    16. amfarrell commented on Jul 12, 2010

      amfarrellmannequin
      Mannequin
      The attempt to install setuptools indicates that zlib may actually be required it seems.
      I download setuptools-0.6c11-py2.7.egg from 
      http://pypi.python.org/pypi/setuptools
      and, as instructed at http://pypi.python.org/pypi/setuptools#id4
      and run  `sh setuptools-0.6c11-py2.7.egg`
      however get the following exception:
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
      zipimport.ZipImportError: can't decompress data; zlib not available
      dlafarrell:/localhome/afarrell$ sh setuptools-0.6c11-py2.7.egg 
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
      zipimport.ZipImportError: can't decompress data; zlib not available

      Given that this is an import error, I infer that
      this may just be a problem with the egg; no import may be needed.
      If thats the case then the egg should change to reflect that.

    17. amfarrell commented on Jul 12, 2010

      amfarrellmannequin
      Mannequin

      No dice. unless I'm mistaken, this needs to be included in the distribution.

      My current best solution looks like finding the source to
      zlib, putting it in my path to install setuptools.
      then installing zlib properly

      traceback for your pleasure:
      ============================

      Traceback (most recent call last):
        File "setup.py", line 94, in <module>
          scripts = scripts,
        File "/usr/local/lib/python2.7/distutils/core.py", line 152, in setup
          dist.run_commands()
        File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
          self.run_command(cmd)
        File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
          cmd_obj.run()
        File "/localhome/afarrell/setuptools-0.6c11/setuptools/command/install.py", line 76, in run
          self.do_egg_install()
        File "/localhome/afarrell/setuptools-0.6c11/setuptools/command/install.py", line 96, in do_egg_install
          self.run_command('bdist_egg')
        File "/usr/local/lib/python2.7/distutils/cmd.py", line 326, in run_command
          self.distribution.run_command(command)
        File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
          cmd_obj.run()
        File "/localhome/afarrell/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 236, in run
          dry_run=self.dry_run, mode=self.gen_header())
        File "/localhome/afarrell/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 527, in make_zipfile
          z = zipfile.ZipFile(zip_filename, mode, compression=compression)
        File "/usr/local/lib/python2.7/zipfile.py", line 651, in __init__
          "Compression requires the (missing) zlib module"
      RuntimeError: Compression requires the (missing) zlib module
    18. amfarrell commented on Jul 12, 2010

      amfarrellmannequin
      Mannequin

      Apologies. Error on my part.

      For those that run into the same problem:
      Though zlib is installed on an earlier version of python,
      you need to have (ob debian) the package zlib1g-dev installed
      when you build python.

    19. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions