Remove use of allow_cleanup_failure in test_backends.py
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
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:
with raises_regex(TypeError, 'pip install netcdf4'):
open_dataset(tmp_file, engine='scipy')
The way to fix this is to use mocking of some sort, to intercept calls to backend file objects and close them afterwards.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in test_backends.py by locating allow_cleanup_failure and the tests that open files before raising errors, including the open_dataset example with engine='scipy'. Review how backend file objects are handled, then verify the tests use mocking and no longer leave temporary files behind.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100