Skip to content

Commit

Permalink
Fix windows path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Jan 15, 2025
1 parent 5f658d9 commit 7762220
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
20 changes: 7 additions & 13 deletions tests/unit/base_tests_zarrio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,11 +1029,11 @@ def test_basic(self):
export_io.export(src_io=read_io)

self.assertTrue(os.path.exists(self.store_path[1]))
self.assertEqual(foofile.container_source, os.path.abspath(self.store_path[0]).replace("\\", "/"))
self.assertEqual(foofile.container_source, os.path.abspath(self.store_path[0]))

with ZarrIO(self.store_path[1], manager=get_foo_buildmanager(), mode="r") as read_io:
read_foofile = read_io.read()
self.assertEqual(read_foofile.container_source, os.path.abspath(self.store_path[1]).replace("\\", "/"))
self.assertEqual(read_foofile.container_source, os.path.abspath(self.store_path[1]))
self.assertContainerEqual(foofile, read_foofile, ignore_hdmf_attrs=True)

def test_basic_container(self):
Expand All @@ -1051,11 +1051,11 @@ def test_basic_container(self):
export_io.export(src_io=read_io, container=read_foofile)

self.assertTrue(os.path.exists(self.store_path[1]))
self.assertEqual(foofile.container_source, os.path.abspath(self.store_path[0]).replace("\\", "/"))
self.assertEqual(foofile.container_source, os.path.abspath(self.store_path[0]))

with ZarrIO(self.store_path[1], manager=get_foo_buildmanager(), mode="r") as read_io:
read_foofile = read_io.read()
self.assertEqual(read_foofile.container_source, os.path.abspath(self.store_path[1]).replace("\\", "/"))
self.assertEqual(read_foofile.container_source, os.path.abspath(self.store_path[1]))
self.assertContainerEqual(foofile, read_foofile, ignore_hdmf_attrs=True)

def test_container_part(self):
Expand Down Expand Up @@ -1145,9 +1145,7 @@ def test_soft_link_group(self):
with ZarrIO(self.store_path[1], manager=get_foo_buildmanager(), mode="r") as read_io:
read_foofile2 = read_io.read()
if isinstance(self.store_path[1], str):
self.assertEqual(
read_foofile2.foo_link.container_source, os.path.abspath(self.store_path[1]).replace("\\", "/")
)
self.assertEqual(read_foofile2.foo_link.container_source, os.path.abspath(self.store_path[1]))
else:
self.assertEqual(read_foofile2.foo_link.container_source, self.store_path[1].path)

Expand Down Expand Up @@ -1177,9 +1175,7 @@ def test_external_link_group(self):
read_foofile2 = read_io.read()
# make sure the linked group is read from the first file
if isinstance(self.store_path[0], str):
self.assertEqual(
read_foofile2.foo_link.container_source, os.path.abspath(self.store_path[0]).replace("\\", "/")
)
self.assertEqual(read_foofile2.foo_link.container_source, os.path.abspath(self.store_path[0]))
else:
self.assertEqual(read_foofile2.foo_link.container_source, self.store_path[0].path)

Expand Down Expand Up @@ -1236,9 +1232,7 @@ def test_external_link_dataset(self):
with ZarrIO(self.store_path[2], manager=get_foo_buildmanager(), mode="r") as read_io:
read_foofile2 = read_io.read()
# make sure the linked dataset is read from the first file
self.assertEqual(
read_foofile2.foofile_data.store.store.path, os.path.abspath(self.store_path[0]).replace("\\", "/")
)
self.assertEqual(read_foofile2.foofile_data.store.store.path, os.path.abspath(self.store_path[0]))

def test_external_link_link(self):
"""Test that exporting a written file with external links to external links maintains the links."""
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_zarrio.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class TestExportZarrToZarrSubdirectory(BaseTestExportZarrToZarr):

def setUp(self):
os.makedirs("test_dir")
self.store_path = [f"test_dir/file{i}.zarr" for i in range(3)]
self.store_path = [os.path.join("test_dir", f"file{i}.zarr") for i in range(3)]
self.manager = get_foo_buildmanager()

def tearDown(self):
Expand Down

0 comments on commit 7762220

Please sign in to comment.