-
Notifications
You must be signed in to change notification settings - Fork 161
ENH: Fail Python tests on warnings during runtime #866
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
base: main
Are you sure you want to change the base?
Conversation
SimonRit
left a comment
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.
Looks good but can you document in the commit log the reason for adding all these options? Can you also add a commit introducing a warning to check that it works? I would remove the commit before merging.
|
I removed rtkPolynomialGainCorrectionImageFilter from WRAPPER_SUBMODULE_ORDER, this should return a warning and the test should fail. |
| pip install pytest matplotlib | ||
| pytest $GITHUB_WORKSPACE/test/*.py -vv -W "ignore:builtin type swig" | ||
| pytest $GITHUB_WORKSPACE/test/*.py -vv -s -W error -W "ignore:builtin type swig" 2> /tmp/stderr.log |
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.
What's the purpose of -W "ignore:builtin type swig"?
I'd suggest to use mktemp in place of /tmp/stderr.log to avoid problems with, e.g., two process writing on the same file.
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.
Just to ignore some known issues in SWIG (tracked in swig/swig#2881). The warnings appear because SWIG is not setting the module attribute on its builtin types.
This should be fixed when ITK use SWIG 4.4.
I changed /tmp/stderr.log for mktemp
5ffdd0d to
0471c2a
Compare
SimonRit
left a comment
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.
That does not seem to work as the tests pass and rtkPolynomialGainCorrectionImageFilter jhas been removed from WRAPPER_SUBMODULE_ORDER?
d4a4e53 to
be99727
Compare
- Redirect stderr to mktemp to capture C++ warnings from ITK modules - Check stderr log for "Warning" messages and fail the build if found This ensures the CI catches C++ warnings like unknown parameter from SWIG.
This ensures the CI catches both Python and C++ warnings like unknown parameter from SWIG.