Closed Graenni closed 2 months ago
Also the tests are failing because pyPublicDecompWT is not included in the environment file for github actions: https://github.com/pytroll/satpy/blob/main/continuous_integration/environment.yaml
@sfinkens @ameraner @pnuu do you have any opinion on this PR?
@Graenni CI is failing, is the decompress
function function working as it should with compressed data for you? In which case it might be the mocking messing things up.
@mraspaud yes, I am able to successfully read and process compressed HRIT files.
Which Python version are you using while running Satpy locally?
The error is
FAILED satpy/tests/reader_tests/test_hrit_base.py::TestHRITFileHandlerCompressed::test_read_band_filepath - TypeError: a bytes-like object is required, not 'str'
I'll see what I get running the tests, but first lunch :grin:
I run Python3.11. I can successfully load seviri l1b hrit with compression.
I get the same error while running the tests locally. Do they pass for you?
That is, does pytest satpy/tests/reader_tests/test_hrit_base.py::TestHRITFileHandlerCompressed
pass?
I added a debugger break-point in the decompress()
function and it is never accessed by the tests.
No wonder the function is not called as the first mock just overrides it:
with mock.patch("satpy.readers.hrit_base.decompress", side_effect=fake_decompress) as mock_decompress:
I did not run the tests locally so far, sorry. I just used satpy with the changes of this pr as I would normally and then the decompression worked as expected. Seems to be an issue with the way tests are configured as you already figured out.
@Graenni I think I fixed the tests, can you check my changes and tell me if the fake decompression is inline with what you expect?
I got TypeError: fake_decompress() takes 0 positional arguments but 1 was given
.
Attention: Patch coverage is 77.27273%
with 5 lines
in your changes missing coverage. Please review.
Project coverage is 96.07%. Comparing base (
99697f7
) to head (862c558
). Report is 23 commits behind head on main.
Files with missing lines | Patch % | Lines |
---|---|---|
satpy/readers/hrit_base.py | 44.44% | 5 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
satpy/readers/hrit_base.py | 4 | 9 | 44.44% | ||
<!-- | Total: | 17 | 22 | 77.27% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
satpy/readers/seadas_l2.py | 3 | 96.97% | ||
<!-- | Total: | 3 | --> |
Totals | |
---|---|
Change from base Build 10814739875: | 0.007% |
Covered Lines: | 52390 |
Relevant Lines: | 54475 |
@sfinkens @ameraner @pnuu do you have any opinion on this PR?
Awesome, thanks a lot for adding this @Graenni !
@Graenni I think I fixed the tests, can you check my changes and tell me if the fake decompression is inline with what you expect?
@mraspaud yes, the return value of fake_decompress is in agreement with what is returned by the original decompress function. the success of the test might be a bit misleading, since decompression is not really tested. But because we do not have the possibility to compress some data (do we?), I don't see a better way to at least test the workflow when the compression flag is set in the header.
I'm merging this, thanks for the contribution @Graenni !
AUTHORS.md
if not there already