-
Notifications
You must be signed in to change notification settings - Fork 12
Add unit tests for bonds #113
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
Conversation
pm-blanco
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.
In search_bond:
- there is an uncovered line in 2549 that only triggers when the switch
hard_checkis active:
sys.exit(1) In get_bond_length:
- Same issue as before in line 2003
Other than that, it looks very good to me. Thank you for taking the initiative to take care of this @jngrad.
Could you also update the Changelog?
This is meant to be that way. If the original authors intended these errors to be recoverable, they would have opted to raise an exception instead of triggering a fatal error. I'm planning to open a ticket next week to discuss this topic and propose a more sustainable alternative, because it's not a good design. The Python session crashes without producing a traceback, making it impossible for users to understand what caused the fatal error. It's also untestable: you can try catch a As part of this discussion, I'll also touch upon the print statements, which print warnings to stdout instead of stderr, making it more difficult to investigate issues in a slurm job where stdout and stderr and redirected to different files. In addition, print statements don't show the filename and line number to help you diagnose the source of the error, something that I'll look into producing a MWE next week, when I have more time to experiment with |
I can tell you that the original author simply did not think too much about it when wrote those lines ;) I agree that we should replace this logic with a better code design, that is also why I raised this issue. What you propose sounds like a much more cleaner solution, I like it. Let's then leave those lines uncovered by now and add coverage once we refactor the error handling. |
* Modernize testsuite * Reduce code duplication * Redesign serialization/deserialization code * Improve exception handling * Serialize bonds with JSON * Update Changelog
Description of changes:
ast.literal_eval()by equivalentjson.loads()