-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
Translate warnings to Python #1201
Translate warnings to Python #1201
Conversation
6ffb1ac
to
09c6ede
Compare
Codecov Report
@@ Coverage Diff @@
## main #1201 +/- ##
==========================================
- Coverage 65.41% 65.38% -0.03%
==========================================
Files 318 318
Lines 46085 46095 +10
Branches 19604 19604
==========================================
- Hits 30145 30141 -4
- Misses 13426 13439 +13
- Partials 2514 2515 +1
Continue to review full report at Codecov.
|
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 @ischoegl! This looks like it will be a nice change, and it'll be nice to be able to manage warnings by built-in Python methods.
interfaces/cython/cantera/examples/kinetics/custom_reactions.py
Outdated
Show resolved
Hide resolved
b431837
to
8f2bd17
Compare
@bryanwweber ... thank you for the review! I ended up implementing a more comprehensive C++ backend for a more fine-grained warning system that should mesh well with various API's. I also included a test that ensures that warnings are raised correctly. |
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 @ischoegl! A couple more small things here.
dc14d7f
to
e451173
Compare
@bryanwweber ... 😅 Testing the warning system ended up creating battles with some of the work-arounds that were put in since 2.5.1 for testing purposes, specifically 5f5a005 and 80c1e56. As those methods do not allow for fine-grained control and are de-facto redundant, I decided to take them out. Regarding your comment about pytest: using warning filters would allow for further removing methods that @speth put in earlier, specifically |
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, @ischoegl. Overall, I think this is a good change, and most of the implementation makes sense to me. There were just a few particular issues that I wanted to address.
9404138
to
2ac2059
Compare
2ac2059
to
8db281c
Compare
@bryanwweber and @speth ... I believe both of your change requests are now fully addressed. Thanks for all suggestions! |
Raise warnings as native Python warnings
8db281c
to
1883be4
Compare
This passes for me if I run |
@bryanwweber ... thanks for trying to simplify by introducing |
@ischoegl I've got it working locally, I just need to commit & push |
These functions are much easier to read than the previous wrapper versions.
1883be4
to
4a6c372
Compare
@ischoegl Presuming the checks pass this time, this should be good to |
@bryanwweber ... 🎉 ... things passed. Looks like the fixture is pretty similar to what |
@ischoegl Great minds!!! Merged 😄 |
Changes proposed in this pull request
warn_deprecated
is raised asDeprecationWarning
andwarn_user
is raised asUserWarning
(on C++ the output is changed fromCanteraWarning
toUserWarning
for consistency)If applicable, fill in the issue number this pull request is fixing
Closes Cantera/enhancements#136
If applicable, provide an example illustrating new features this pull request is introducing
and
Another nice thing is that users will be pointed to the line in existing Python code where the warning is invoked, e.g.
(this is from an instance where a
DeprecationWarning
in an example was previously not caught by the test suite; this is also addressed in this PR)Checklist
scons build
&scons test
) and unit tests address code coverage