-
Notifications
You must be signed in to change notification settings - Fork 4
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
WP5 indiv process testing: code style improvements #21
Conversation
- avoid in-place dict mutations - add type hints - use more keyword args for call robustness - more clearly mark internal helpers as private - finetune exception handling - finetune pytest asserts (where default value rendering should be good enough)
src/openeo_test_suite/tests/processes/processing/test_example.py
Outdated
Show resolved
Hide resolved
except Exception as e: | ||
# TODO: skipping on a generic `Exception` is very liberal and might hide real issues |
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.
Unless we have a more specific handler, this should be kept for now and not just raise the exceptions. It's a behavioral change, not a code style change.
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 liberal except
clause hid a bug I introduced with this PR.
Luckily I noticed it in another way.
I guess your intention is to skip when something is not implemented, so I would propose to change it to
except NotImplementedError
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 can only check what I meant once I can run it again ;-)
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'm going through it now to check what changes if we change to NotImplementedError and if the additional failures are test issues etc. Stay tuned ;-)
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 just pushed 7507407 which switches to only NotImplementedError and fixes a couple of mostly datetime-related things in the background so that test coverage is still similar. Feel free to have a look at the changes and whether they are inline with your changes.
src/openeo_test_suite/tests/processes/processing/test_example.py
Outdated
Show resolved
Hide resolved
src/openeo_test_suite/tests/processes/processing/test_example.py
Outdated
Show resolved
Hide resolved
src/openeo_test_suite/tests/processes/processing/test_example.py
Outdated
Show resolved
Hide resolved
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.
Thanks. Some change requests, otherwise looks good in theory.
Wasn't able to run it, it looks like a recent merge corrupted the individual process tests.
pytest src/openeo_test_suite/tests/processes/processing/test_example.py --runner=dask
worked before, is not running any longer.
what error do you get? Please create a bug ticket if that makes sense |
Done: #23 |
I restored the liberal |
example["throws"], result.__class__.__name__ | ||
) | ||
# TODO: better way to report this warning? | ||
_log.warning( |
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 don't get this warning anylonger in the logs, I tried before this PR and after and these ones are missing. Any clue why?
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.
logs of successful tests are hidden by default.
logs of failing tests should be visible
you can disable capturing of all logs (and print statements) with options --capture=no --log-cli-level=INFO
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.
But that shouldn't have changed. The number of successful/failing tests is the same, just the logs for this specific line are missing.
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.
do you have an example use case (process that fails on some implementation) for this, so I can play with this too?
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.
7b28019
to
7507407
Compare
hmm this PR got in conflicting state with main branch. |
- avoid in-place dict mutations - add type hints - use more keyword args for call robustness - more clearly mark internal helpers as private - finetune exception handling - finetune pytest asserts (where default value rendering should be good enough) Rebased version of PR #21
See #32 |
- avoid in-place dict mutations - add type hints - use more keyword args for call robustness - more clearly mark internal helpers as private - finetune exception handling - finetune pytest asserts (where default value rendering should be good enough) Rebased version of PR #21
@m-mohr I went through .../processing/test_example.py while playing with the individual process tests and made some minor code style tweaks along the way.
I wanted to run them with you first before merging into main.
included tweaks: