-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: IO unit test creates file at home directory #40091
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
Comments
@chrispe Thanks for the bug report. I can confirm this on master that a sometest file is created in the home directory(I'm testing this on MacOS). I think we should at least check for the existence of a file before overwriting and for sure clean up the file after we're done. cc @twoertwein |
That test should use: import pandas._testing as tm
with tm.ensure_clean() as path:
.... |
In this test case we want to ensure that the path is able to expand correctly (i.e. |
you are right! If that is the only place where a file in "~"needs to be cleaned up, I wouldn't extend |
By a quick look at the rest of the tests, it seems like this is the only hardcoded case. If you agree, I can continue with a PR to use the |
Yes, please go ahead :) |
Uh oh!
There was an error while loading. Please reload this page.
The unit test at
pandas/tests/io/test_common.py
produces a file using a hardcoded name as shown below:Problem description
A developer may encounter an empty file "sometest" appearing in their home directory (after running
pytest
). If the developer is unaware of that, then it may raise some wrong security concerns on their side. Also, in the extreme scenario that the developer has a file at the exact same path, then its content may be replaced.Expected Output
I would expect the file produced by the unit test to be temporary and get deleted afterwards. Also, that the filename is generated rather than hardcoded.
The text was updated successfully, but these errors were encountered: