From 0c075666610934d44a5e23ff623205afcf04f032 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Tue, 12 Dec 2023 14:35:35 +0100 Subject: [PATCH] move the test to the indicated place --- tests/integration/hdf5/test_io.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/integration/hdf5/test_io.py b/tests/integration/hdf5/test_io.py index d04a796c6..77e3256c4 100644 --- a/tests/integration/hdf5/test_io.py +++ b/tests/integration/hdf5/test_io.py @@ -123,6 +123,19 @@ def test_write_no_cache_spec(self): io.write(self.container, cache_spec=False) with File(self.path, 'r') as f: self.assertNotIn('specifications', f) + + def test_file_creation_io_modes(self): + io_modes_that_create_file = ["w", "w-", "x"] + + with tempfile.TemporaryDirectory() as temp_dir: + temp_dir = Path(temp_dir) + for io_mode in io_modes_that_create_file: + file_path = temp_dir / f"test_io_mode={io_mode}.nwb" + + # Test file creation + nwbfile = mock_NWBFile() + with NWBHDF5IO(str(file_path), io_mode) as io: + io.write(nwbfile) class TestHDF5WriterWithInjectedFile(TestCase): @@ -519,17 +532,3 @@ def test_round_trip_with_pathlib_path(self): read_file = io.read() self.assertContainerEqual(read_file, self.nwbfile) - -class TestNWBHDF5IOModes(TestCase): - def test_file_creation_and_deletion(self): - io_modes_that_create_file = ["w", "w-", "x"] - - with tempfile.TemporaryDirectory() as temp_dir: - temp_dir = Path(temp_dir) - for io_mode in io_modes_that_create_file: - file_path = temp_dir / f"test_io_mode={io_mode}.nwb" - - # Test file creation - nwbfile = mock_NWBFile() - with NWBHDF5IO(str(file_path), io_mode) as io: - io.write(nwbfile)