summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gzip.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-115961: Improve tests for compressed file-like objects (GH-115963) ↵Miss Islington (bot)2024-02-281-11/+172
| | | | | | | | | | | | | | | (GH-116032) * Increase coverage for compressed file-like objects initialized with a file name, an open file object, a file object opened by file descriptor, and a file-like object without name and mode attributes (io.BytesIO) * Increase coverage for name, fileno(), mode, readable(), writable(), seekable() in different modes and states * No longer skip tests with bytes names * Test objects implementing the path protocol, not just pathlib.Path. (cherry picked from commit e72576c48b8be1e4f22c2f387f9769efa073c5be) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-108111: Flush gzip write buffer before seeking, fixing bad writes ↵Miss Islington (bot)2023-08-241-0/+12
| | | | | | | | | (GH-108341) (#108402) gh-108111: Flush gzip write buffer before seeking, fixing bad writes (GH-108341) (cherry picked from commit 2eb60c1934f47671e6b3c9b90b6d9f1912d829a0) Co-authored-by: Chris Markiewicz <effigies@gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.12] GH-106160: Fix test_gzip failing under WASI, which does not have ↵Miss Islington (bot)2023-06-281-1/+1
| | | | | | | | | | | | zlib. (GH-106167) (#106170) GH-106160: Fix test_gzip failing under WASI, which does not have zlib. (GH-106167) Fix test_gzip's failure under WASI, which does not have zlib, by using test.support.import_helper.import_module to import zlib. (gzip unconditionally imports zlib, so this does not cause any new skips.) (cherry picked from commit 161012fc25910a47423bae8012398bf519a88140) Co-authored-by: T. Wouters <thomas@python.org>
* [3.12] GH-105808: Fix a regression introduced in GH-101251 (GH-105910) (#105920)Miss Islington (bot)2023-06-191-0/+49
| | | | | | | | | GH-105808: Fix a regression introduced in GH-101251 (GH-105910) Fix a regression introduced in pythonGH-101251, causing GzipFile.flush() to not flush the compressor (nor pass along the zip_mode argument). (cherry picked from commit 1858db7cbdbf41aa600c954c15224307bf81a258) Co-authored-by: T. Wouters <thomas@python.org>
* bpo-46267: Test compresslevel in gzip.compress (#30416)Ruben Vorderman2022-05-031-0/+9
| | | Fixes #90425
* bpo-40280: Skip subprocess-based tests on wasm32-emscripten (GH-30615)Christian Heimes2022-01-251-1/+3
|
* bpo-45507: EOFErrors should be thrown for truncated gzip members (GH-29029)Ruben Vorderman2021-11-191-0/+8
|
* bpo-45229: Remove test_main in many tests (GH-28405)Serhiy Storchaka2021-09-191-6/+1
| | | | | | | | | Instead of explicitly enumerate test classes for run_unittest() use the unittest ability to discover tests. This also makes these tests discoverable and runnable with unittest. load_tests() can be used for dynamic generating tests and adding doctests. setUpModule(), tearDownModule() and addModuleCleanup() can be used for running code before and after all module tests.
* bpo-44439: BZ2File.write() / LZMAFile.write() handle buffer protocol ↵Ma Lin2021-06-221-0/+9
| | | | | | | correctly (GH-26764) No longer use len() to get the length of the input data. For some buffer protocol objects, the length obtained by using len() is wrong.
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25171)Inada Naoki2021-04-041-6/+6
| | | | | | | | | | | * Fix test_float * Fix _osx_support * Fix test_fstring * Fix test_gc * Fix test_gzip * Fix test_hashlib * Fix unrelated whitespace issue Co-authored-by: Ned Deily <nad@python.org>
* bpo-43316: gzip: Fix sys.exit() usage. (GH-24652)Inada Naoki2021-02-261-1/+1
|
* bpo-43316: gzip: CLI uses non-zero return code on error. (GH-24647)Ruben Vorderman2021-02-251-4/+4
| | | | Exit code is now 1 instead of 0. A message is printed to stderr instead of stdout. This is the proper behaviour for a tool that can be used in scripts.
* bpo-40275: Use new test.support helper submodules in tests (GH-21451)Hai Shi2020-08-031-11/+13
|
* bpo-41069: Make TESTFN and the CWD for tests containing non-ascii ↵Serhiy Storchaka2020-06-251-4/+14
| | | | characters. (GH-21035)
* bpo-39389: gzip: fix compression level metadata (GH-18077)William Chargin2020-01-211-0/+20
| | | | | | As described in RFC 1952, section 2.3.1, the XFL (eXtra FLags) byte of a gzip member header should indicate whether the DEFLATE algorithm was tuned for speed or compression ratio. Prior to this patch, archives emitted by the `gzip` module always indicated maximum compression.
* bpo-28286: Deprecate opening GzipFile for writing implicitly. (GH-16417)Serhiy Storchaka2019-11-161-1/+3
| | | | Always specify the mode argument for writing.
* bpo-6584: Add a BadGzipFile exception to the gzip module. (GH-13022)Zackery Spytz2019-05-131-0/+9
| | | | | Co-Authored-By: Filip Gruszczyński <gruszczy@gmail.com> Co-Authored-By: Michele Orrù <maker@tumbolandia.net>
* bpo-16079: fix duplicate test method name in test_gzip. (GH-12827)Gregory P. Smith2019-04-141-1/+1
|
* bpo-34898: Add mtime parameter to gzip.compress(). (GH-9704)guoci2018-11-071-0/+11
| | | | | Without setting mtime, time.time() will be used as the timestamp which will end up in the compressed data and each invocation of the compress() function will vary over time.
* bpo-34969: Add --fast, --best on the gzip CLI (GH-9833)Stéphane Wirtel2018-11-031-2/+30
|
* bpo-23596: Add unit tests for the command line for the gzip module (GH-9775)Stéphane Wirtel2018-10-091-6/+93
| | | | Add unit tests for the command line for the gzip module
* bpo-28286: Add tests for the mode argument of GzipFile. (#4074)Serhiy Storchaka2017-10-221-0/+24
|
* Issue #28227: gzip now supports pathlibBerker Peksag2016-10-021-0/+22
| | | | Patch by Ethan Furman.
* Use sequence repetition instead of bytes constructor with integer argument.Serhiy Storchaka2016-09-111-2/+2
|
* Issue #25626: Change zlib to accept Py_ssize_t and cap to UINT_MAXMartin Panter2015-11-201-0/+9
| | | | | | | | | | | | | | The underlying zlib library stores sizes in “unsigned int”. The corresponding Python parameters are all sizes of buffers filled in by zlib, so it is okay to reduce higher values to the UINT_MAX internal cap. OverflowError is still raised for sizes that do not fit in Py_ssize_t. Sizes are now limited to Py_ssize_t rather than unsigned long, because Python byte strings cannot be larger than Py_ssize_t. Previously this could result in a SystemError on 32-bit platforms. This resolves a regression in the gzip module when reading more than UINT_MAX or LONG_MAX bytes in one call, introduced by revision 62723172412c.
* Issue #23529: Limit the size of decompressed data when reading fromAntoine Pitrou2015-04-101-2/+21
| | | | | | | | GzipFile, BZ2File or LZMAFile. This defeats denial of service attacks using compressed bombs (i.e. compressed payloads which decompress to a huge size). Patch by Martin Panter and Nikolaus Rath.
* Issue #23688: Added support of arbitrary bytes-like objects and avoidedSerhiy Storchaka2015-03-231-0/+37
| | | | | unnecessary copying of memoryview in gzip.GzipFile.write(). Original patch by Wolfgang Maier.
* Issue #20875: Merge from 3.3Ned Deily2014-03-091-0/+7
|\
| * Issue #20875: Prevent possible gzip "'read' is not defined" NameError.Ned Deily2014-03-091-0/+7
| | | | | | | | Patch by Claudiu Popa.
| * Issue #19936: Remove executable bits from C source files and several forgottenSerhiy Storchaka2014-01-161-0/+0
| | | | | | | | test files.
* | Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-1/+0
|\ \ | |/ | | | | | | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang lines in the unittestgui and checkpip scripts.
| * Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-1/+0
| | | | | | | | | | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface. Fixed shebang line to use python3 executable in the unittestgui script.
| * Back out patch for #1159051, which caused backwards compatibility problems.Georg Brandl2013-05-121-14/+0
| |
* | Issue #19222: Add support for the 'x' mode to the gzip module.Nadeem Vawda2013-10-181-0/+37
|/ | | | Original patch by Tim Heaney.
* Close #17666: Fix reading gzip files with an extra field.Serhiy Storchaka2013-04-081-0/+7
|
* Issue #1159051: GzipFile now raises EOFError when reading a corrupted fileSerhiy Storchaka2013-01-221-0/+14
|\ | | | | | | | | with truncated header or footer. Added tests for reading truncated gzip, bzip2, and lzma files.
| * Issue #1159051: GzipFile now raises EOFError when reading a corrupted fileSerhiy Storchaka2013-01-221-0/+15
| | | | | | | | | | with truncated header or footer. Added tests for reading truncated gzip and bzip2 files.
* | Fix GzipFile's handling of filenames given as bytes objects.Nadeem Vawda2012-06-191-0/+14
|\ \ | |/ | | | | Add relevant tests for GzipFile, and also for BZ2File and LZMAFile.
| * Fix GzipFile's handling of filenames given as bytes objects.Nadeem Vawda2012-06-191-0/+14
| |
* | Add fileobj support to gzip.open().Nadeem Vawda2012-06-041-0/+13
| |
* | Really fix test_gzip failures on Windows.Nadeem Vawda2012-05-061-5/+7
| |
* | Fix test_gzip failures on Windows.Nadeem Vawda2012-05-061-3/+3
| |
* | Separate tests for gzip.GzipFile and gzip.open.Nadeem Vawda2012-05-061-15/+14
| |
* | Closes #13989: Add support for text modes to gzip.open().Nadeem Vawda2012-05-061-0/+88
| | | | | | | | Also, add tests for gzip.open().
* | Merge: #13781: Fix GzipFile to work with os.fdopen()'d file objects.Nadeem Vawda2012-01-181-0/+8
|\ \ | |/
| * Issue #13781: Fix GzipFile to work with os.fdopen()'d file objects.Nadeem Vawda2012-01-181-0/+8
| |
* | #13012: use splitlines(keepends=True/False) instead of splitlines(0/1).Ezio Melotti2011-09-281-2/+2
| |
* | Issue #10791: Implement missing method GzipFile.read1(), allowing GzipFileAntoine Pitrou2011-04-041-0/+23
|/ | | | to be wrapped in a TextIOWrapper. Patch by Nadeem Vawda.
* #9424: Replace deprecated assert* methods in the Python test suite.Ezio Melotti2010-11-201-2/+2
|
* #10465: fix broken delegation in __getattr__ of _PaddedFile.Georg Brandl2010-11-201-0/+6
|