Skip to content
14 changes: 6 additions & 8 deletions fsspec/implementations/tests/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,8 @@ def test_get_file_seekable_default(fs, remote_dir, tmp_path):

# Test default behavior (seekable=False)
local_file = tmp_path / "test_default.txt"
fs.get_file(remote_dir + "/test_file.txt", str(local_file))
with open(local_file, "rb") as f:
assert f.read() == data
with pytest.raises(OSError, match="only valid on seekable files"):
Copy link
Member

@martindurant martindurant Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we get() the file just because it's not seekable? Isn't that exactly what the code before this PR was doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we call size() inside the get_file()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we can read a stream until it's done. We don't want that workflow to become unusable.

fs.get_file(remote_dir + "/test_file.txt", str(local_file))

# Test with explicit seekable=True
local_file_seekable = tmp_path / "test_seekable.txt"
Expand All @@ -292,11 +291,10 @@ def test_get_file_seekable_default(fs, remote_dir, tmp_path):

# Test with explicit seekable=False
local_file_not_seekable = tmp_path / "test_not_seekable.txt"
fs.get_file(
remote_dir + "/test_file.txt", str(local_file_not_seekable), seekable=False
)
with open(local_file_not_seekable, "rb") as f:
assert f.read() == data
with pytest.raises(OSError, match="only valid on seekable files"):
fs.get_file(
remote_dir + "/test_file.txt", str(local_file_not_seekable), seekable=False
)


def test_cat_file_seekable_override(fs, remote_dir):
Expand Down
Loading