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
DM-11771: Close files that have been left hanging #66
Conversation
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.
Looks good to me. I do wonder whether all of those del
calls are needed (especially the 3 in the middle)
tests/testCameraMapper.py
Outdated
@@ -413,16 +439,19 @@ def test(self): | |||
registryA = butler._repos.inputs()[0].repo._mapper.registry | |||
registryB = butler._repos.outputs()[0].repo._mapper.registry | |||
self.assertEqual(id(registryA), id(registryB)) | |||
del registryA | |||
del registryB |
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 am guessing that these three del
calls are not needed because the assignment later will overwrite them.
tests/testCameraMapper.py
Outdated
|
||
del registryA | ||
del registryB | ||
del butler |
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.
Do these make a difference now? The variables will disappear at end of scope and the gc.collect()
will clean up.
with open(os.path.join(self.repoARoot, 'registry.sqlite3'), 'w') as f: | ||
f.write('123') | ||
self._createRegistry(os.path.join(self.repoARoot, 'registry.sqlite3')) | ||
del butler |
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 might be needed, but keeping it means that the linter won't complain about butler
only being used once.
No description provided.