Skip to content

Commit

Permalink
Fix ResourceWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
danepitkin committed Aug 4, 2023
1 parent fb569f8 commit fca7663
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions python/pyarrow/tests/parquet/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,26 @@ def datadir(base_datadir):
def s3_bucket(s3_server):
boto3 = pytest.importorskip('boto3')
botocore = pytest.importorskip('botocore')
s3_bucket_name = 'test-s3fs'

host, port, access_key, secret_key = s3_server['connection']
s3 = boto3.resource(
s3_client = boto3.client(
's3',
endpoint_url='http://{}:{}'.format(host, port),
aws_access_key_id=access_key,
aws_secret_access_key=secret_key,
config=botocore.client.Config(signature_version='s3v4'),
region_name='us-east-1'
)
bucket = s3.Bucket('test-s3fs')

try:
bucket.create()
s3_client.create_bucket(Bucket=s3_bucket_name)
except Exception:
# we get BucketAlreadyOwnedByYou error with fsspec handler
pass
return 'test-s3fs'
pass # we get BucketAlreadyOwnedByYou error with fsspec handler
finally:
s3_client.close()

return s3_bucket_name


@pytest.fixture
Expand Down

0 comments on commit fca7663

Please sign in to comment.