[New-bugs-announce] [issue6026] test_(zipfile|zipimport|gzip|distutils) fail if zlib is not available

Ezio Melotti report at bugs.python.org
Fri May 15 02:58:26 CEST 2009


New submission from Ezio Melotti <ezio.melotti at gmail.com>:

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?

----------
components: Tests
messages: 87783
nosy: ezio.melotti
severity: normal
status: open
title: test_(zipfile|zipimport|gzip|distutils) fail if zlib is not available
type: behavior
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6026>
_______________________________________


More information about the New-bugs-announce mailing list