Add reproducibility test for `gzip.compress()`
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Esamina la PR collegata gh-151214 e individua i test esistenti del modulo gzip prima di iniziare. Aggiungi i controlli di riproducibilità per gzip.compress() mostrati nell'issue, quindi conferma che gli output attesi rimangano stabili e considera qualsiasi modifica intenzionale in What's New.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- testing-qa
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100