-
-
Notifications
You must be signed in to change notification settings - Fork 337
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
grass.pygrass: GridModule clean up temporary mapsets when exception occurs #2614
grass.pygrass: GridModule clean up temporary mapsets when exception occurs #2614
Conversation
When an exception (input raster map does not exist) occurs during the `run()` method of an instance of the `GridModule` class.
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 for fixing this separately from the other issue. I think the general idea is good, but some changes would make it better - see comments.
I think a test would be doable for the specific bug being fixed. pytest seems like a good choice for that. The "positive" case where everything works is probably easier to test with grass.gunittest. There are some doctest-based tests for GridModule, but I don't know how good they are and there seems to be some confusion between tests of grass.pygrass.modules and grass.pygrass.modules.grid.
Generally, it seems that the resource handling should be more clear. The resource allocation and cleanup should be linked together in a better way, e.g., by having the cleanup set up where the resources are allocated. This may overall improve the class, but for fixing the bug, the current approach in this PR is enough.
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.
This is great - short and sweet!
I have two comments, the test actually requires some attention.
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.
Great!
Describe the bug
run()
method of theGridModule
class instance doesn't clean up temporary MAPSETs when exception occurs (input raster map doesn't exists).To Reproduce
Steps to reproduce the behavior:
Expected behavior
Clean up the temporary MAPSETs when an exception (input raster map does not exist) occurs during the
run()
method of an instance of theGridModule
class.System description (please complete the following information):