Skip to content

Commit

Permalink
Merge pull request #465 from juliangilbey/test-artefact-to-tmpdir
Browse files Browse the repository at this point in the history
Save temporary file in test to temporary location
  • Loading branch information
ccordoba12 committed Aug 4, 2023
2 parents 29ef6a2 + a923ffe commit a46a2bd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spyder_kernels/utils/tests/test_iofuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,14 @@ def test_spydata_export(input_namespace, expected_namespace,
pass


def test_save_load_hdf5_files():
def test_save_load_hdf5_files(tmp_path):
"""Simple test to check that we can save and load HDF5 files."""
h5_file = tmp_path / "test.h5"
data = {'a' : [1, 2, 3, 4], 'b' : 4.5}
iofuncs.save_hdf5(data, "test.h5")
iofuncs.save_hdf5(data, h5_file)

expected = ({'a': np.array([1, 2, 3, 4]), 'b': np.array(4.5)}, None)
assert repr(iofuncs.load_hdf5("test.h5")) == repr(expected)
assert repr(iofuncs.load_hdf5(h5_file)) == repr(expected)


def test_load_dicom_files():
Expand Down

0 comments on commit a46a2bd

Please sign in to comment.