Add reproducibility test for `gzip.compress()`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
The issue https://github.com/python/cpython/issues/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 https://github.com/python/cpython/issues/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
Linked PRs
- gh-151214
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Überprüfe den verknüpften PR gh-151214 und finde vor dem Beginn die vorhandenen Tests für das gzip-Modul. Füge die im Issue gezeigten Reproduzierbarkeitsprüfungen für gzip.compress() hinzu, bestätige anschließend, dass die erwarteten Ausgaben stabil bleiben, und berücksichtige jede beabsichtigte Änderung in What's New.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- testing-qa
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100