-
Notifications
You must be signed in to change notification settings - Fork 21
Group internal resource lists and reorganize xprocess into a package #85
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
Group internal resource lists and reorganize xprocess into a package #85
Conversation
xprocess.py
Outdated
| # been isued for that particular XProcessInfo | ||
| # Object (subprocess requirement) | ||
| for (info, _), proc in zip(self._info_objects, self._popen_instances): | ||
| for (info, _), proc in zip( |
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.
the new structure is not a enhancmenet
resource should be a list of a simple classes that contain all resources of a process, just moving attributes into dict keys is not a sensible change, - literally all this does it make the code to access it longer
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.
I recall taking some time to figure out all allocated resources when we had the resource leak problem back in #61. It would have been a lot quicker if all resources (Popen instances, XProcessInfo instances and file handles) were all neatly and explicitly grouped in a resources structure such as a dict. So in my opinion this is still an improvement.
That being said, I agree that keeping the resources in a separate class seems like a better way of going about this. If I understand correctly, you're proposing having something like XProcessResources where all resources of a given XProcess instance would be kept (?). If this is the case, we could even further separate concerns by moving the cleanup logic from XProcess._clean_up_resources to XProcessResources.free. @RonnyPfannschmidt
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.
Structurally I would recommend a context manager or a close method to match other common apis
|
We now have a |
|
Unfortunately I may not be able to get back to to this this weekend |
Addressing #67
__del__toXProcessResourcesso resources are automatically released on end of test executionXProcess._force_resource_cleanupupon interruptionsxprocessinto a package and usefind_packagesin order to avoid issues such as _internal.py isn't shipped with the 0.18.0 version installed by PyPi #77