Skip to content

Conversation

invain01
Copy link
Contributor

@invain01 invain01 commented Oct 6, 2025

Summary of Changes: Replace ensure_clean with pytest temp_file/tmp_path

This PR refactors three test files to replace usage of the legacy tm.ensure_clean context manager with pytest's modern temporary file fixtures (tmp_path or temp_file). This change aligns with pandas testing best practices and improves test reliability and readability.

Modified Files

  • pandas/tests/io/parser/test_c_parser_only.py
  • pandas/tests/io/parser/dtypes/test_dtypes_basic.py
  • pandas/tests/io/parser/common/test_read_errors.py

Key Changes

  • All usages of tm.ensure_clean were replaced with either tmp_path (for custom filenames) or temp_file (for generic temp files).
  • Corresponding test functions were updated to accept the required pytest fixture as an argument.

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Oct 6, 2025
@mroeschke mroeschke added this to the 3.0 milestone Oct 6, 2025
@mroeschke mroeschke merged commit 849073a into pandas-dev:main Oct 6, 2025
47 checks passed
@mroeschke
Copy link
Member

Thanks @invain01

@invain01 invain01 deleted the new branch October 7, 2025 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants