-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CI: test for file leakage #30162
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
Merged
Merged
CI: test for file leakage #30162
Changes from 7 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0bc1c96
Make fixture to check for file leaks
jbrockmendel c9fb6ec
docstring
jbrockmendel a20b31f
checks on all tests in test_readers
jbrockmendel 3c6366e
BUG: close oepn files
jbrockmendel 322ede3
fixturize
jbrockmendel 127dfee
troubleshoot yield behavior
jbrockmendel 013cdd7
check file leaks only in excel for now
jbrockmendel 707bf5b
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel a3e05bd
Merge branch 'master' of https://github.com/pandas-dev/pandas into ci…
jbrockmendel a637e50
bump openpyxl deep to 2.5.6
jbrockmendel a041e87
bump to 2.5.7
jbrockmendel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
really this works? this is very weird to do inside a
__del__
.reading the link I would rather so something like (and only in the openpyxl engine)
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.
maybe need a try/except around the close
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.
it does work, agreed that calling gc is ugly, will try the xml_source.close thing.
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.
no dice, no
sheets
attributeThere 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.
right i am not sure of the correct attribute here
but shoulda be clear if step into it
just really want to avoid the gc call in del
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.
@WillAyd any thoughts on how to make this work without gc call?
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.
Can we move this cleanup to a test fixture used for the relevant tests? And just ensure that it's called for the relevant openpyxl version before
check_for_file_leaks
is run?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 guess as a general comment can we move this to the
_openpyxl
instead of checking the engine in the base class? Or does that not work?I think you can just use the
get_sheet_by_index
property to iterate over the sheets and close the related xml_sourceThere 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.
Hmm ignore comment before on moving to
_openpyxl
- I see this is for theExcelFile
class and not theReader
I think you could do something like:
IIUC
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.
still no dice. I'm sure there is some amount of digging around that can effectively re-implement the fix that openpyxl did, but im not wild about digging into openpyxl internals, especially for a known-fixed bug