-
Notifications
You must be signed in to change notification settings - Fork 214
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
Make gmt.clib functions into methods of APISession #38
Comments
leouieda
added a commit
that referenced
this issue
Aug 10, 2017
The functions in `gmt.clib` need to keep be passed the session pointer and users have to remember to get it from `APISession`, which just handles creating and deleting the pointer. For example: with APISession() as session: call_module(session, ...) Turn the functions into methods of the context manager and rename it `LibGMT`. Hide away the session management functions as private methods. So now it looks like: with LibGMT() as lib: lib.call_module(...) Fixes #38
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No point in having this class if all it's good for is creating and destroying the session. It might as well define the C API functions and pass in the "session" argument for us. This would also make the clib code more testable because we can mock things like the OS name and check that exceptions are being raised.
The text was updated successfully, but these errors were encountered: