Return FSFile instances from find_files_and_readers if passed fs instance
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
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?).
I agree with @djhoese here, the fs files should just returned.
That makes totally sense. I removed the argument.
Codecov Report
Merging #2178 (37eb530) into main (3fd4c45) will decrease coverage by
0.01%. The diff coverage is93.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: |
Coverage decreased (-0.006%) to 94.937% when pulling 78ec3f4cf79cec5dda9da9cf2234a0f8d67ad58b on BENR0:feat_files_readers_fsfile into f4888b0f1777493e9fee1e91062c117f99b1de83 on pytroll:main.
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.
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.
Something seems to be messed up in the tests here. Do they pass locally?
I get the same failures locally.
@pnuu thanks for checking. I'll let @BENR0 fix this then
I'll have a look at this after the tests pass.
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?
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 | |
|---|---|
| Change from base Build 5078286241: | -0.001% |
| Covered Lines: | 47038 |
| Relevant Lines: | 49306 |