Skip to content

Commit a9d608e

Browse files
TST: write generic surface CSV fixtures to pathlib paths
pandas 3 treats py.path.local as a writable buffer and each chunk overwrites the file, leaving only the last row; tmp_path_factory avoids it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XDW574AQLHTSeBM9K172TX
1 parent a50d07d commit a9d608e

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎tests/fixtures/generic_surfaces/generic_surfaces_fixtures.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33

44

55
@pytest.fixture(scope="session")
6-
def filename_valid_coeff(tmpdir_factory):
6+
def filename_valid_coeff(tmp_path_factory):
77
"""Creates temporary files used to test if generic surfaces
88
initializes correctly from CSV files"""
9-
filename = tmpdir_factory.mktemp("aero_surface_data").join("valid_coefficients.csv")
9+
filename = tmp_path_factory.mktemp("aero_surface_data").joinpath(
10+
"valid_coefficients.csv"
11+
)
1012
pd.DataFrame(
1113
{
1214
"alpha": [0, 1, 2, 3, 0.1],
@@ -31,10 +33,10 @@ def filename_valid_coeff(tmpdir_factory):
3133
},
3234
)
3335
)
34-
def filename_invalid_coeff(tmpdir_factory, request):
36+
def filename_invalid_coeff(tmp_path_factory, request):
3537
"""Creates temporary CSV files used to test if generic surfaces
3638
raises errors when initialized incorrectly from CSV files"""
37-
filename = tmpdir_factory.mktemp("aero_surface_data").join(
39+
filename = tmp_path_factory.mktemp("aero_surface_data").joinpath(
3840
"tmp_invalid_coefficients.csv"
3941
)
4042
pd.DataFrame(request.param).to_csv(filename, index=False)

‎tests/fixtures/generic_surfaces/linear_generic_surfaces_fixtures.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44

55
@pytest.fixture(scope="session")
6-
def filename_valid_coeff_linear_generic_surface(tmpdir_factory):
6+
def filename_valid_coeff_linear_generic_surface(tmp_path_factory):
77
"""Creates temporary files used to test if a linear generic surface
88
initializes correctly from CSV files"""
9-
filename = tmpdir_factory.mktemp("aero_surface_data").join(
9+
filename = tmp_path_factory.mktemp("aero_surface_data").joinpath(
1010
"valid_coefficients_lgs.csv"
1111
)
1212
pd.DataFrame(
@@ -33,10 +33,10 @@ def filename_valid_coeff_linear_generic_surface(tmpdir_factory):
3333
},
3434
)
3535
)
36-
def filename_invalid_coeff_linear_generic_surface(tmpdir_factory, request):
36+
def filename_invalid_coeff_linear_generic_surface(tmp_path_factory, request):
3737
"""Creates temporary CSV files used to test if a linear generic surface
3838
raises errors when initialized incorrectly from CSV files"""
39-
filename = tmpdir_factory.mktemp("aero_surface_data").join(
39+
filename = tmp_path_factory.mktemp("aero_surface_data").joinpath(
4040
"tmp_invalid_coefficients_lgs.csv"
4141
)
4242
pd.DataFrame(request.param).to_csv(filename, index=False)

0 commit comments

Comments
 (0)