Skip to content

Conversation

@Chiwendaiyue
Copy link
Contributor

Replace ensure_clean_store with tmp_path in test_timezones.py

What does this PR do?
This PR migrates the test file pandas/tests/io/pytables/test_timezones.py from using the custom ensure_clean_store utility to the standard pytest tmp_path fixture.
Why is this change needed?
As part of the ongoing effort to modernize the pandas test suite, we're replacing the custom ensure_clean utility function with pytest's built-in tmp_path fixture. This:

  • Reduces code duplication
  • Uses standard pytest functionality
  • Makes tests more consistent across the codebase
  • Follows pytest best practices
    What changes were made?
  • Replaced with ensure_clean_store(setup_path) as store: with path = tmp_path / "filename.h5" and with pd.HDFStore(path) as store:
  • Used unique filenames for each test to prevent conflicts
  • Removed the import of ensure_clean_store
  • Maintained all existing test logic and functionality

Testing

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

Thanks @Chiwendaiyue

@Chiwendaiyue Chiwendaiyue deleted the replace-ensure-clean-test-timezones-final branch October 24, 2025 07:03
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.

TST: Replace ensure_clean utility function with the temp_file pytest fixture

2 participants