-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove use of allow_cleanup_failure in test_backends.py #1668
Comments
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity If this issue remains relevant, please comment here or remove the |
Maybe I don't understand the whole problem—can we just use a temp dir for these? |
We currently try to explicitly close any temp files we created at the end of each test. Are you suggesting that we should leave that clean-up to the operating system? |
IIUC (and my understand isn't advanced here!), python will close and delete temp files & directories once they leave scope: From
https://docs.python.org/3/library/tempfile.html#tempfile.TemporaryDirectory Or is it that we want to test that they're closed? |
It might more informative to try removing and this option and to see what fails when you run CI :). Our current temp file decorator will try to delete files as soon as we exit the scope, but if the file wasn't closed first this results in an exception on Windows. (This can happen because we only generate file names and let lower level library like netCDF open/close the files -- there are usually no Python level file objects, so we can't use |
OK, yes I see now. I didn't know about that windows behavior. There's a broader CPython issue about it too. |
This exists for the benefit of Windows, on which trying to delete an open file results in an error. But really, it would be nice to have a test suite that doesn't leave any temporary files hanging around.
The main culprit is tests like this, where opening a file triggers an error:
The way to fix this is to use mocking of some sort, to intercept calls to backend file objects and close them afterwards.
The text was updated successfully, but these errors were encountered: