-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add deregister_toolkit method #614
Conversation
This pull request introduces 2 alerts and fixes 1 when merging 3f3be8a into 97d31e6 - view on LGTM.com new alerts:
fixed alerts:
|
This pull request introduces 2 alerts and fixes 1 when merging 5365cf9 into 131d86c - view on LGTM.com new alerts:
fixed alerts:
|
I bumped this up in priority since it's been desired multiple times in recent memory. I've merged in the other 0.7.0 changes, updated tests and docstrings, and also catch the case of attempting to deregister an un-registered toolkit. I believe this is ready for review now. I've completely punted on retooling Tangentially, the toolkit wrappers could probably do with a
I could probably sneak that in here - but when I say that, it typically works to not be true after trying it. |
This pull request introduces 2 alerts and fixes 1 when merging 45ab3da into 131d86c - view on LGTM.com new alerts:
fixed alerts:
|
This pull request introduces 2 alerts and fixes 1 when merging 3fa8d0f into 131d86c - view on LGTM.com new alerts:
fixed alerts:
|
This pull request introduces 2 alerts and fixes 1 when merging d78e111 into e1b6e74 - view on LGTM.com new alerts:
fixed alerts:
|
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.
Nice tests -- Very clever and thorough. Made a few direct suggestions, and there's one docstring that seems to have wandered off, but after that I think this is good to merge.
Thanks, Matt!
with pytest.raises(ToolkitUnavailableException): | ||
toolkit_registry.deregister_toolkit(RDKitToolkitWrapper) | ||
|
||
def deregister_from_global_registry(self): |
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.
Yup. This is a pretty weird one. Hopefully this can be made more sensical when we move to a singleton design pattern or context manager approach.
""" | ||
if not isinstance(toolkit_wrapper, ToolkitWrapper): | ||
msg = "Something other than a ToolkitWrapper object was passed to ToolkitRegistry.add_toolkit()\n" | ||
msg += "Given object {} of type {}".format(toolkit_wrapper, | ||
type(toolkit_wrapper)) | ||
raise Exception(msg) | ||
raise InvalidToolkitError(msg) |
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.
Hooray for specific exceptions!
#468
GLOBAL_TOOLKIT_REGISTRY
(codecov counts the relevant lines of code as tested, but I think they're only ever called by things that use this:grep -R "GLOBAL_TOOLKIT_REGISTRY" openforcefield/tests/
comes up empty; related GLOBAL_TOOLKIT_REGISTRY does not behave as anticipated #493)