Skip to content

Commit

Permalink
test: ignore deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Sep 6, 2024
1 parent 2a9f934 commit b978323
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions python/kvikio/tests/test_aws_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import multiprocessing as mp
import socket
import time
import warnings
from contextlib import contextmanager

import pytest
Expand Down Expand Up @@ -68,16 +69,20 @@ def s3_base(endpoint_ip, endpoint_port):
def s3_context(s3_base, bucket, files=None):
if files is None:
files = {}
client = boto3.client("s3", endpoint_url=s3_base)
client.create_bucket(Bucket=bucket, ACL="public-read-write")
for f, data in files.items():
client.put_object(Bucket=bucket, Key=f, Body=data)
yield kvikio.S3Context(s3_base)
for f, data in files.items():
try:
client.delete_object(Bucket=bucket, Key=f)
except Exception:
pass
with warnings.catch_warnings():
# boto3 calls `datetime.datetime.utcnow()`, which is deprecated
# in Python v3.12.
warnings.filterwarnings("ignore", category=DeprecationWarning)
client = boto3.client("s3", endpoint_url=s3_base)
client.create_bucket(Bucket=bucket, ACL="public-read-write")
for f, data in files.items():
client.put_object(Bucket=bucket, Key=f, Body=data)
yield kvikio.S3Context(s3_base)
for f, data in files.items():
try:
client.delete_object(Bucket=bucket, Key=f)
except Exception:
pass


@pytest.mark.parametrize("size", [10, 100, 1000])
Expand Down

0 comments on commit b978323

Please sign in to comment.