Skip to content

Commit d97099a

Browse files
authored
Ensure right error type for get() on nonexistent (fsspec#695)
1 parent 54e8faa commit d97099a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

gcsfs/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,7 @@ async def _get_file_request(
16221622
headers=self._get_headers(headers),
16231623
timeout=self.requests_timeout,
16241624
) as r:
1625-
r.raise_for_status()
1625+
validate_response(r.status, None, rpath)
16261626
try:
16271627
size = int(r.headers["content-length"])
16281628
except (KeyError, ValueError):

gcsfs/tests/test_core.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,3 +1697,8 @@ def test_near_find(gcs):
16971697
gcs.touch(f"{TEST_BUCKET}/inner/aa/file")
16981698
out = gcs.find(f"{TEST_BUCKET}/inner/a")
16991699
assert not out
1700+
1701+
1702+
def test_get_error(gcs):
1703+
with pytest.raises(FileNotFoundError):
1704+
gcs.get_file(f"{TEST_BUCKET}/doesnotexist", "other")

0 commit comments

Comments
 (0)