Skip to content

Commit

Permalink
Fix validation in NWB testing util classes
Browse files Browse the repository at this point in the history
  • Loading branch information
rly authored Oct 21, 2023
1 parent 2aceed0 commit f23ed5c
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/pynwb/testing/testh5io.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,14 @@ def getContainer(self, nwbfile):
def validate(self):
""" Validate the created files """
if os.path.exists(self.filename):
with NWBHDF5IO(self.filename, mode='r') as io:
errors = pynwb_validate(io)
if errors:
for err in errors:
raise Exception(err)
errors = pynwb_validate(paths=[self.filename])
if errors:
raise Exception("\n".join(errors))

if os.path.exists(self.export_filename):
with NWBHDF5IO(self.filename, mode='r') as io:
errors = pynwb_validate(io)
if errors:
for err in errors:
raise Exception(err)
errors = pynwb_validate(paths=[self.export_filename])
if errors:
raise Exception("\n".join(errors))


class AcquisitionH5IOMixin(NWBH5IOMixin):
Expand Down Expand Up @@ -366,13 +362,11 @@ def roundtripExportContainer(self, cache_spec=False):
def validate(self):
"""Validate the created files."""
if os.path.exists(self.filename):
with NWBHDF5IO(self.filename, mode='r') as io:
errors = pynwb_validate(io)
if errors:
raise Exception("\n".join(errors))
errors = pynwb_validate(paths=[self.filename])
if errors:
raise Exception("\n".join(errors))

if os.path.exists(self.export_filename):
with NWBHDF5IO(self.filename, mode='r') as io:
errors = pynwb_validate(io)
if errors:
raise Exception("\n".join(errors))
errors = pynwb_validate(paths=[self.export_filename])
if errors:
raise Exception("\n".join(errors))

0 comments on commit f23ed5c

Please sign in to comment.