-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Open
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
Description
The issue #112346 was reported, which was a failure to keep reproducibility in gzip
module output from Python 3.10 to 3.11.
There was a fix discussed and rejected in #112346
I think it makes sense not to actually change things back, but failing to merge the PR means we also failed to add unit tests.
Can we please add a general-purpose, fragile reproducibility test for the gzip module, so that this problem does not recur?
Ex. test that the output of gzip.compress("Hello world")
remains stable
def test_gzip_reproducibility():
"""If this test fails, gzip.compress does not give reproducible output. Either fix that, or document the change in What's New and change the constant 'expected' below."""
expected = b'\x1f\x8b\x08\x00\xa2\xd2\xe1g\x02\xff\xf3H\xcd\xc9\xc9W(\xcf/\xcaI\x01\x00R\x9e\xd6\x8b\x0b\x00\x00\x00'
assert gzip.compress(b"Hello world") == expected
expected =
b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\xf3H\xcd\xc9\xc9W(\xcf/\xcaI\x01\x00R\x9e\xd6\x8b\x0b\x00\x00\x00'
assert gzip.compress(b"Hello world", mtime=0) == expected
MaciejKucia
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-featureA feature request or enhancementA feature request or enhancement
Projects
Status
No status