Skip to content

Commit

Permalink
Attempt fix windows pathing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Jan 15, 2025
1 parent 2c67ef2 commit 5f658d9
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 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(os.path.relpath(foofile.container_source), self.store_path[0])
self.assertEqual(foofile.container_source, os.path.abspath(self.store_path[0]).replace("\\", "/"))

with ZarrIO(self.store_path[1], manager=get_foo_buildmanager(), mode="r") as read_io:
read_foofile = read_io.read()
self.assertEqual(os.path.relpath(read_foofile.container_source), self.store_path[1])
self.assertEqual(read_foofile.container_source, os.path.abspath(self.store_path[1]).replace("\\", "/"))
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(os.path.relpath(foofile.container_source), self.store_path[0])
self.assertEqual(foofile.container_source, os.path.abspath(self.store_path[0]).replace("\\", "/"))

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

def test_container_part(self):
Expand Down Expand Up @@ -1145,7 +1145,9 @@ 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(os.path.relpath(read_foofile2.foo_link.container_source), self.store_path[1])
self.assertEqual(
read_foofile2.foo_link.container_source, os.path.abspath(self.store_path[1]).replace("\\", "/")
)
else:
self.assertEqual(read_foofile2.foo_link.container_source, self.store_path[1].path)

Expand Down Expand Up @@ -1175,7 +1177,9 @@ 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(os.path.relpath(read_foofile2.foo_link.container_source), self.store_path[0])
self.assertEqual(
read_foofile2.foo_link.container_source, os.path.abspath(self.store_path[0]).replace("\\", "/")
)
else:
self.assertEqual(read_foofile2.foo_link.container_source, self.store_path[0].path)

Expand Down Expand Up @@ -1232,7 +1236,9 @@ 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(os.path.relpath(read_foofile2.foofile_data.store.store.path), self.store_path[0])
self.assertEqual(
read_foofile2.foofile_data.store.store.path, os.path.abspath(self.store_path[0]).replace("\\", "/")
)

def test_external_link_link(self):
"""Test that exporting a written file with external links to external links maintains the links."""
Expand Down

0 comments on commit 5f658d9

Please sign in to comment.