Skip to content

Commit

Permalink
Use temp dir for io test
Browse files Browse the repository at this point in the history
  • Loading branch information
f0uriest committed Mar 1, 2024
1 parent 4698f41 commit f34a365
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_magnetic_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand All @@ -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
Expand Down

0 comments on commit f34a365

Please sign in to comment.