From f34a365cdc0ba6e70de982bb4d5472bb057c3168 Mon Sep 17 00:00:00 2001 From: Rory Conlin Date: Fri, 1 Mar 2024 17:03:21 -0500 Subject: [PATCH] Use temp dir for io test --- tests/test_magnetic_fields.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_magnetic_fields.py b/tests/test_magnetic_fields.py index 8d06ea9dd7..5096e3e026 100644 --- a/tests/test_magnetic_fields.py +++ b/tests/test_magnetic_fields.py @@ -424,7 +424,7 @@ def test_fourier_current_potential_field_symmetry(self): with pytest.raises(ValueError): field.Phi_mn = np.ones((basis.num_modes + 1,)) - def test_io_fourier_current_field(self): + def test_io_fourier_current_field(self, tmpdir_factory): """Test that i/o works for FourierCurrentPotentialField.""" surface = FourierRZToroidalSurface( R_lmn=jnp.array([10, 1]), @@ -446,8 +446,9 @@ def test_io_fourier_current_field(self): modes_Z=surface._Z_basis.modes[:, 1:], NFP=10, ) - field.save("test_field.h5") - field2 = load("test_field.h5") + tmpdir = tmpdir_factory.mktemp("test_io_fourier_current_field") + field.save(tmpdir.join("test_field.h5")) + field2 = load(tmpdir.join("test_field.h5")) assert field.eq(field2) @pytest.mark.unit