-
-
Couldn't load subscription status.
- Fork 19.2k
Open
Open
Copy link
Labels
Testingpandas testing functions or related to the test suitepandas testing functions or related to the test suitegood first issue
Description
The pandas test suite uses an ensure_clean utility function to create a temporary file for testing
pandas/pandas/_testing/contexts.py
Line 101 in 22bae73
| def ensure_clean(filename=None) -> Generator[Any]: |
This utility should be largely redundant with the temp_file pytest fixture
Line 2105 in 22bae73
| def temp_file(tmp_path): |
Since there are about ~180 occurrences of ensure_clean in the code base, this issue should be completed in multiple PRs that replaces ensure_clean with temp_file in a particular file. Therefore, this issue can be worked on by multiple contributors.
For those interested in working on this issue:
- Comment below on which file in
pandas/testsyou'll be working on. - Submit a PR that replace
ensure_cleanwithtemp_filewhich still passes the tests.
When submitting a PR for a fix:
- If a test doesn't appear to explicitly need to test a
strfile argument, please change the test to usetemp_filedirectly (i.e. avoid doingstr(temp_file)if not needed) - If a test requires a specific file name or extension (e.g.
.xls), please construct an argument using the pytesttmp_pathfixture instead (e.g.path = tmp_path / "tmp.xls")
Once all the uses of ensure_clean are replaced, a separate PR to remove ensure_clean would be welcome.
Metadata
Metadata
Assignees
Labels
Testingpandas testing functions or related to the test suitepandas testing functions or related to the test suitegood first issue