Skip to content

Commit

Permalink
test CI (#922)
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant authored Dec 17, 2024
1 parent 7dd0e36 commit 005d1de
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
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

0 comments on commit 005d1de

Please sign in to comment.