Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Use FileNotFoundError when no file found rather than FileExistsError #479

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/earthkit/data/readers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def reader(source, path, **kwargs):
r = _non_existing(source, path, **kwargs)
if r is not None:
return r
raise FileExistsError(f"No such file exists: '{path}'")
raise FileNotFoundError(f"No such file exists: '{path}'")

if os.path.getsize(path) == 0:
r = _empty(source, path, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion tests/readers/test_empty_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_empty_file_reader():


def test_nonexisting_file_reader():
with pytest.raises(FileExistsError):
with pytest.raises(FileNotFoundError):
earthkit.data.from_source("file", "__nonexistingfile__")


Expand Down
Loading