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

test CI #922

Merged
merged 9 commits into from
Dec 17, 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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Run Tests
shell: bash -l {0}
run: pytest -vv s3fs
run: pytest -vv -s s3fs -k test_write_blocks


pre-commit:
Expand Down
4 changes: 3 additions & 1 deletion s3fs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2395,7 +2395,9 @@ def upload_part(part_data: bytes):
if len(part_data) == 0:
return
part = len(self.parts) + 1
logger.debug("Upload chunk %s, %s" % (self, part))
logger.debug(
"Upload chunk %s, %s; %s bytes" % (self, part, len(part_data))
)

out = self._call_s3(
"upload_part",
Expand Down
16 changes: 11 additions & 5 deletions s3fs/tests/test_s3fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1287,10 +1287,10 @@ def test_write_blocks(s3):
assert f.mpu
assert f.parts
assert s3.info(test_bucket_name + "/temp")["size"] == 6 * 2**20
with s3.open(test_bucket_name + "/temp", "wb", block_size=10 * 2**20) as f:
with s3.open(test_bucket_name + "/temp2", "wb", block_size=10 * 2**20) as f:
f.write(b"a" * 15 * 2**20)
assert f.buffer.tell() == 0
assert s3.info(test_bucket_name + "/temp")["size"] == 15 * 2**20
assert s3.info(test_bucket_name + "/temp2")["size"] == 15 * 2**20


def test_readline(s3):
Expand Down Expand Up @@ -1406,21 +1406,27 @@ def test_append(s3):
f.write(b"a" * 10 * 2**20)
with s3.open(a, "ab") as f:
pass # append, no write, big file
assert s3.cat(a) == b"a" * 10 * 2**20
data = s3.cat(a)
assert len(data) == 10 * 2**20 and set(data) == set(b"a")

with s3.open(a, "ab") as f:
assert f.parts is None
f._initiate_upload()
assert f.parts
assert f.tell() == 10 * 2**20
f.write(b"extra") # append, small write, big file
assert s3.cat(a) == b"a" * 10 * 2**20 + b"extra"
data = s3.cat(a)
assert len(data) == 10 * 2**20 + len(b"extra")
assert data[-5:] == b"extra"

with s3.open(a, "ab") as f:
assert f.tell() == 10 * 2**20 + 5
f.write(b"b" * 10 * 2**20) # append, big write, big file
assert f.tell() == 20 * 2**20 + 5
assert s3.cat(a) == b"a" * 10 * 2**20 + b"extra" + b"b" * 10 * 2**20
data = s3.cat(a)
assert len(data) == 10 * 2**20 + len(b"extra") + 10 * 2**20
assert data[10 * 2**20 : 10 * 2**20 + 5] == b"extra"
assert set(data[-10 * 2**20 :]) == set(b"b")

# Keep Head Metadata
head = dict(
Expand Down
Loading