[Python-checkins] r46967 - in python/trunk: Doc/lib/libzipfile.tex Lib/test/test_zipfile.py Lib/test/test_zipfile64.py Lib/zipfile.py Misc/NEWS

Neal Norwitz nnorwitz at gmail.com
Thu Jun 15 10:27:57 CEST 2006


On 6/15/06, ronald.oussoren <python-checkins at python.org> wrote:
> Author: ronald.oussoren
> Date: Thu Jun 15 10:14:18 2006
> New Revision: 46967
>
> Added:
>    python/trunk/Lib/test/test_zipfile64.py
> Modified:
>    python/trunk/Doc/lib/libzipfile.tex
>    python/trunk/Lib/test/test_zipfile.py
>    python/trunk/Lib/zipfile.py
>    python/trunk/Misc/NEWS
> Log:
> Patch #1446489  (zipfile: support for ZIP64)
>
>
> Modified: python/trunk/Doc/lib/libzipfile.tex

Please add versionadded and versionchanged tags for any API diffs.

> Modified: python/trunk/Lib/test/test_zipfile.py
> ==============================================================================
> --- python/trunk/Lib/test/test_zipfile.py       (original)
> +++ python/trunk/Lib/test/test_zipfile.py       Thu Jun 15 10:14:18 2006

> +class TestZip64InSmallFiles(unittest.TestCase):
> +    # These tests test the ZIP64 functionality without using large files,
> +    # see test_zipfile64 for proper tests.
> +
> +    def setUp(self):
> +        self._limit = zipfile.ZIP64_LIMIT
> +        zipfile.ZIP64_LIMIT = 5
> +
> +        line_gen = ("Test of zipfile line %d." % i for i in range(0, 1000))
> +        self.data = '\n'.join(line_gen)
> +
> +        # Make a source file with some lines
> +        fp = open(TESTFN, "wb")
> +        fp.write(self.data)
> +        fp.close()

> +    def tearDown(self):
> +        zipfile.ZIP64_LIMIT = self._limit
> +        os.remove(TESTFN)
> +        os.remove(TESTFN2)

Please remove the files in in setUp too.  That way the tests won't
fail if another test left the files around.  Same for the new test
file (test_zip64.py I think).

> @@ -103,7 +350,8 @@
>          self.assertRaises(RuntimeError, zipf.testzip)
>
>  def test_main():
> -    run_unittest(TestsWithSourceFile, OtherTests)
> +    run_unittest(TestsWithSourceFile, TestZip64InSmallFiles, OtherTests, PyZipFileTests)
> +    #run_unittest(TestZip64InSmallFiles)

Why is Zip64 commented out?

> Added: python/trunk/Lib/test/test_zipfile64.py

> +    def zipTest(self, f, compression):
> +        # Create the ZIP archive
> +        filecount = int(((1 << 32) / len(self.data)) * 1.5)
> +        zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True)

Should use // instead of / ?

I need to finish the review tomorrow.

n


More information about the Python-checkins mailing list