Skip to content

TST: No longer produce test_stata.dta file after running test suite #58381

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

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pandas/tests/io/test_stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1962,7 +1962,7 @@ def test_writer_118_exceptions(self, temp_file):
"dtype_backend",
["numpy_nullable", pytest.param("pyarrow", marks=td.skip_if_no("pyarrow"))],
)
def test_read_write_ea_dtypes(self, dtype_backend, temp_file):
def test_read_write_ea_dtypes(self, dtype_backend, temp_file, tmp_path):
df = DataFrame(
{
"a": [1, 2, None],
Expand All @@ -1974,7 +1974,8 @@ def test_read_write_ea_dtypes(self, dtype_backend, temp_file):
index=pd.Index([0, 1, 2], name="index"),
)
df = df.convert_dtypes(dtype_backend=dtype_backend)
df.to_stata("test_stata.dta", version=118)
stata_path = tmp_path / "test_stata.dta"
df.to_stata(stata_path, version=118)

df.to_stata(temp_file)
written_and_read_again = self.read_dta(temp_file)
Expand Down