Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romasku committed Sep 2, 2021
1 parent afc3076 commit 96ce630
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions neuro-sdk/src/neuro_sdk/buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ async def renew_token_loop() -> None:
sas_credential.update(credentials.credentials["sas_token"])
expiry = isoparse(credentials.credentials["expiry"])

task = asyncio.create_task(renew_token_loop())
task = asyncio.ensure_future(renew_token_loop())
try:
yield
finally:
Expand Down Expand Up @@ -602,14 +602,24 @@ async def put_blob(

@asyncgeneratorcontextmanager
async def fetch_blob(self, key: str, offset: int = 0) -> AsyncIterator[bytes]:
downloader = await self._client.get_blob_client(key).download_blob(
offset=offset
)
try:
downloader = await self._client.get_blob_client(key).download_blob(
offset=offset
)
except ResourceNotFoundError:
raise ResourceNotFound(
f"There is no object with key {key} in bucket {self.bucket.name}"
)
async for chunk in downloader.chunks():
yield chunk

async def delete_blob(self, key: str) -> None:
await self._client.get_blob_client(key).delete_blob()
try:
await self._client.get_blob_client(key).delete_blob()
except ResourceNotFoundError:
raise ResourceNotFound(
f"There is no object with key {key} in bucket {self.bucket.name}"
)

async def get_time_diff_to_local(self) -> Tuple[float, float]:
if self._min_time_diff is None or self._max_time_diff is None:
Expand Down

0 comments on commit 96ce630

Please sign in to comment.