Closed musicinmybrain closed 2 months ago
Detailed output for the first failure:
___________________________________________________________________________________________ TestGzip.test_append ____________________________________________________________________________________________
self = <test_gzip_compliance.TestGzip testMethod=test_append>
def test_append(self):
> self.test_write()
tests/test_gzip_compliance.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_gzip_compliance.py:87: in test_write
f.write(data1 * 50)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <gzip_ng on 0x7f0bb7774e60>
data = b' int length=DEFAULTALLOC, err = Z_OK;\n PyObject *RetVal;\n int flushmode = Z_FINISH;\n unsigned long start_tota...ngth=DEFAULTALLOC, err = Z_OK;\n PyObject *RetVal;\n int flushmode = Z_FINISH;\n unsigned long start_total_out;\n\n'
def write(self, data):
self._check_not_closed()
if self.mode != WRITE:
import errno
> raise OSError(errno.EBADF, "write() on read-only GzipNGFile object")
E OSError: [Errno 9] write() on read-only GzipNGFile object
.tox/py313/lib64/python3.13/site-packages/zlib_ng/gzip_ng.py:158: OSError
One interesting change is that gzip.GzipFile.mode
has changed from an integer 1
or 2
to 'rb'
or 'wb'
. However, gzip.READ
and gzip.WRITE
reflect this change, and at a glance it doesn’t look like this particular change is responsible for any of these test failures.
One interesting change is that
gzip.GzipFile.mode
has changed from an integer1
or2
to'rb'
or'wb'
. However,gzip.READ
andgzip.WRITE
reflect this change, and at a glance it doesn’t look like this particular change is responsible for any of these test failures.
Aha, this is it after all! We have
which in Python 3.13 no longer match the values in gzip
.
Changing this line to
READ, WRITE = gzip.READ, gzip.WRITE
fixes all of the test failures. I’ll open a PR.
With
tox -e py312
, all tests pass, but there is a warning:With
tox -e py313
(using Python 3.13.0b1 fromupdates-testing
on Fedora 39), this warning appears to come to fruition: