satpy icon indicating copy to clipboard operation
satpy copied to clipboard

Return FSFile instances from find_files_and_readers if passed fs instance

Open BENR0 opened this issue 3 years ago • 13 comments

This is basically #1472 from @gerritholl. It just was easier to redo the changes based on the current main.

  • [x] Tests added
  • [x] Fully documented

BENR0 avatar Aug 16 '22 09:08 BENR0

Thanks for bringing this conversation up. I've been out of this conversation long enough that I'm not sure I should have a huge say in where it goes. That said, I still have an opinion. :wink:

Yet another keyword argument to this function just screams that this function is bad code and is doing too many things. "Clean Code"-wise we need to think of some other long term solution for this function. I would personally be OK with this new kwarg being removed and instead just return the FSFile if needed (if an fs was passed?).

djhoese avatar Aug 19 '22 01:08 djhoese

I agree with @djhoese here, the fs files should just returned.

mraspaud avatar Nov 09 '22 15:11 mraspaud

That makes totally sense. I removed the argument.

BENR0 avatar Nov 14 '22 10:11 BENR0

Codecov Report

Merging #2178 (37eb530) into main (3fd4c45) will decrease coverage by 0.01%. The diff coverage is 93.75%.

@@            Coverage Diff             @@
##             main    #2178      +/-   ##
==========================================
- Coverage   94.83%   94.83%   -0.01%     
==========================================
  Files         337      337              
  Lines       49451    49482      +31     
==========================================
+ Hits        46896    46925      +29     
- Misses       2555     2557       +2     
Flag Coverage Δ
behaviourtests 4.43% <9.37%> (+<0.01%) :arrow_up:
unittests 95.45% <93.75%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
satpy/readers/__init__.py 97.68% <80.00%> (-0.61%) :arrow_down:
satpy/tests/test_readers.py 98.94% <100.00%> (+0.04%) :arrow_up:

codecov[bot] avatar Dec 01 '22 11:12 codecov[bot]

Coverage Status

Coverage decreased (-0.006%) to 94.937% when pulling 78ec3f4cf79cec5dda9da9cf2234a0f8d67ad58b on BENR0:feat_files_readers_fsfile into f4888b0f1777493e9fee1e91062c117f99b1de83 on pytroll:main.

coveralls avatar Dec 01 '22 12:12 coveralls

The tests seem to be failing, lots of cases where the error is something like AttributeError: module 'satpy.readers' has no attribute 'yaml_reader'. See https://github.com/pytroll/satpy/actions/runs/3712880243/jobs/6294915398#step:10:22319 for the full list. With a quick browse, couldn't spot what causes this.

pnuu avatar Dec 22 '22 20:12 pnuu

I've restarted all the tests. Something weird happened where I think some low-level package didn't import and then that made every reader fail to import.

djhoese avatar Dec 22 '22 20:12 djhoese

Something seems to be messed up in the tests here. Do they pass locally?

mraspaud avatar Feb 02 '23 07:02 mraspaud

I get the same failures locally.

pnuu avatar Feb 02 '23 08:02 pnuu

@pnuu thanks for checking. I'll let @BENR0 fix this then

mraspaud avatar Feb 02 '23 08:02 mraspaud

I'll have a look at this after the tests pass.

gerritholl avatar Feb 02 '23 08:02 gerritholl

This passes:

pytest satpy/tests/reader_tests/

but this fails

pytest satpy/tests/test_readers.py satpy/tests/reader_tests/

So something is cached in test_readers.py and not cleared?

pnuu avatar Feb 02 '23 10:02 pnuu

Pull Request Test Coverage Report for Build 5079643152

  • 30 of 32 (93.75%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.001%) to 95.4%

Changes Missing Coverage Covered Lines Changed/Added Lines %
satpy/readers/init.py 8 10 80.0%
<!-- Total: 30 32
Totals Coverage Status
Change from base Build 5078286241: -0.001%
Covered Lines: 47038
Relevant Lines: 49306

💛 - Coveralls

coveralls avatar May 25 '23 12:05 coveralls