Added new tests and fixed small bugs

This commit is contained in:
Mawoka
2023-06-18 11:43:27 +02:00
parent f99453bcda
commit 8034dd2fdf
7 changed files with 194 additions and 29 deletions
-5
View File
@@ -12,11 +12,6 @@ import aiofiles.os
_DEFAULT_CHUNK_SIZE = 32768 # bytes; arbitrary
async def aioshutil_copyfileobj(async_fsrc, async_fdst, *, chunksize: int = _DEFAULT_CHUNK_SIZE) -> None:
while (chunk := await async_fsrc.read(chunksize)) != b"":
await async_fdst.write(chunk)
class LocalStorage:
def __init__(self, base_path: str):
self.base_path = base_path
+3 -2
View File
@@ -134,8 +134,9 @@ class S3Storage:
)
def size(self, file_name: str) -> int | None:
res = self.client.stat_object(bucket_name=self.bucket_name, object_name=file_name)
if res is None:
try:
res = self.client.stat_object(bucket_name=self.bucket_name, object_name=file_name)
except minio.error.S3Error:
return None
return res.size