Skip to content

Commit

Permalink
Replace IOError -> OSError
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Mar 25, 2024
1 parent 7ae7848 commit 1627682
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/ctapipe/instrument/camera/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def from_table(cls, url_or_table, **kwargs):

version = tab.meta.get("TAB_VER")
if version not in cls.SUPPORTED_TAB_VERSIONS:
raise IOError(f"Unsupported camera geometry table version: {version}")
raise OSError(f"Unsupported camera geometry table version: {version}")

Check warning on line 675 in src/ctapipe/instrument/camera/geometry.py

View check run for this annotation

Codecov / codecov/patch

src/ctapipe/instrument/camera/geometry.py#L675

Added line #L675 was not covered by tests

return cls(
name=tab.meta.get("CAM_ID", "Unknown"),
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/instrument/camera/readout.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def from_table(cls, url_or_table, **kwargs):

version = tab.meta.get("TAB_VER", "")
if version not in cls.SUPPORTED_TAB_VERSIONS:
raise IOError(
raise OSError(

Check warning on line 212 in src/ctapipe/instrument/camera/readout.py

View check run for this annotation

Codecov / codecov/patch

src/ctapipe/instrument/camera/readout.py#L212

Added line #L212 was not covered by tests
f"CameraReadout table has unsupported version: {version},"
f" supported are: {cls.SUPPORTED_TAB_VERSIONS}."
)
Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/io/hdf5merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _get_required_nodes(h5file):
return required_nodes


class CannotMerge(IOError):
class CannotMerge(OSError):
"""Raised when trying to merge incompatible files"""


Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/io/tests/test_eventseeker.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_eventseeker_simtel():
assert event.count == 2
event = seeker.get_event_index(4)
assert event.count == 4
with pytest.raises(IOError):
with pytest.raises(OSError):
seeker.get_event_index(1)
event = seeker.get_event_index(5)
assert event.count == 5
4 changes: 2 additions & 2 deletions src/ctapipe/io/tests/test_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def test_closing_writer(tmp_path):


def test_cannot_read_with_writer(tmp_path):
with pytest.raises(IOError):
with pytest.raises(OSError):
with HDF5TableWriter(tmp_path / "test.h5", "test", mode="r"):
pass

Expand Down Expand Up @@ -984,7 +984,7 @@ class Container1(Container):

# This needs to fail since the mapping is not unique
with HDF5TableReader(path) as reader:
with pytest.raises(IOError):
with pytest.raises(OSError):
generator = reader.read("/values", [Container1, Container1])
next(generator)

Expand Down
2 changes: 1 addition & 1 deletion src/ctapipe/io/tests/test_write_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_write_table(tmp_path):
assert read["speed"].description == "Speed of stuff"

# test error for already existing table
with pytest.raises(IOError):
with pytest.raises(OSError):
write_table(table, output_path, table_path)

# test we can append
Expand Down

0 comments on commit 1627682

Please sign in to comment.