datalad / datalad-next

DataLad extension for new functionality and improved user experience
https://datalad.org
Other
9 stars 10 forks source link

gzip library uses Py3.8 Exception, causes trouble in Py3.7 CI #400

Closed adswa closed 1 year ago

adswa commented 1 year ago

I noticed a failing test in the datalad-core extension CI (e.g., https://github.com/datalad/datalad/actions/runs/5154075785/jobs/9282080243?pr=7398):


=================================== FAILURES ===================================
_____________________ test_compressed_file_stay_compressed _____________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_compressed_file_stay_comp0')

    def test_compressed_file_stay_compressed(tmp_path):
        # this file is offered with transparent compression/decompression
        # by the github webserver, but is also actually gzip'ed
        url = \
            'https://github.com/datalad/datalad-neuroimaging/raw/' \
            '05b45c8c15d24b6b894eb59544daa17159a88945/' \
            'datalad_neuroimaging/tests/data/files/nifti1.nii.gz'

        # first confirm validity of the test approach, opening an
        # uncompressed file should raise an exception
>       with pytest.raises(gzip.BadGzipFile):
E       AttributeError: module 'gzip' has no attribute 'BadGzipFile'

/opt/hostedtoolcache/Python/3.7.16/x64/lib/python3.7/site-packages/datalad_next/url_operations/tests/test_http.py:86: AttributeError

The Exception BadGzipFile has only been added in Python 3.8: https://docs.python.org/3.8/library/gzip.html#gzip.BadGzipFile

adswa commented 1 year ago

Given that Py3.7 EOLs later this month, this might not require attention. I believe the internal module this test is a part of is only released as a pre-release.

mih commented 1 year ago

Yes, I agree. Even with a release, only a test would fail, and only this particular test when actually executed with PY3.7. Not worth an intervention.