-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a testing utility for faking reading #2840
Conversation
Co-authored-by: Martin Raspaud <martin.raspaud@smhi.se> Co-authored-by: Pouria Khalaj <pouria.khalaj@smhi.se>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2840 +/- ##
==========================================
+ Coverage 95.95% 95.98% +0.03%
==========================================
Files 366 368 +2
Lines 53615 53798 +183
==========================================
+ Hits 51446 51639 +193
+ Misses 2169 2159 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. Makes sense. Some concerns:
- I realize this is for users and their applications, but should this be in
satpy/tests/
instead? - Could we have a new section in the documentation (may require a whole new page) regarding "Testing your Satpy code"?
- Users may want to debug their custom composites, both configs and actual execution of custom composite python code. Is there a way to allow for that? I suppose this would require mocking the lower-level Scene readers dictionary and distinguishing between the users
scene_dict
being reader datasets versus composite datasets. Maybe not worth it.
Co-authored-by: David Hoese <david.hoese@ssec.wisc.edu>
|
Sounds good. |
The final three tests at https://github.com/pytroll/satpy/blob/main/satpy/tests/modifier_tests/test_parallax.py test loading a composite via the Maybe those tests could use this utility instead (not sure). |
Pull Request Test Coverage Report for Build 10058493408Warning: This coverage report may be inaccurate.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.
Details
💛 - Coveralls |
doc/source/dev_guide/testing.rst
Outdated
|
||
The ``satpy.testing`` modules provides tools for writing tests of applications that use Satpy. | ||
|
||
- For faking reading, you can use :func:`~satpy.testing.fake_satpy_reading` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't a hard requirement/change for this to be merged, but this wording of "faking reading" seems not as descriptive as I'd like. On one hand I would expect the high-level description to be something like "To allow Scene creation and loading fake datasets without reading files", but that's kind of long. My main point being that "For faking reading" doesn't seem to fully describe what is possible, or rather, why you'd use this functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your wording, so I'll put it in here. The docstring of that function also has an example, so that part is quite clear I think.
This PR adds a testing utility to satpy for faking reading.
Useful for testing programs that use satpy for reading with actually needing to read anything.
Can be used like this:
and the scene will be loaded with the contents of
scene_dict
.AUTHORS.md
if not there already