MCPcopy Create free account
hub / github.com/apache/arrow / test_s3_options

Function test_s3_options

python/pyarrow/tests/test_fs.py:1238–1339  ·  view source on GitHub ↗
(pickle_with_and_without_subtree_filesystem)

Source from the content-addressed store, hash-verified

1236
1237@pytest.mark.s3
1238def test_s3_options(pickle_with_and_without_subtree_filesystem):
1239 pickle_module = pickle_with_and_without_subtree_filesystem
1240 from pyarrow.fs import (AwsDefaultS3RetryStrategy,
1241 AwsStandardS3RetryStrategy, S3FileSystem,
1242 S3RetryStrategy)
1243
1244 fs = S3FileSystem(access_key='access', secret_key='secret',
1245 session_token='token', region='us-east-2',
1246 scheme='https', endpoint_override='localhost:8999')
1247 assert isinstance(fs, S3FileSystem)
1248 assert fs.region == 'us-east-2'
1249 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1250
1251 fs = S3FileSystem(role_arn='role', session_name='session',
1252 external_id='id', load_frequency=100)
1253 assert isinstance(fs, S3FileSystem)
1254 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1255
1256 # Note that the retry strategy won't survive pickling for now
1257 fs = S3FileSystem(
1258 retry_strategy=AwsStandardS3RetryStrategy(max_attempts=5))
1259 assert isinstance(fs, S3FileSystem)
1260
1261 fs = S3FileSystem(
1262 retry_strategy=AwsDefaultS3RetryStrategy(max_attempts=5))
1263 assert isinstance(fs, S3FileSystem)
1264
1265 fs2 = S3FileSystem(role_arn='role')
1266 assert isinstance(fs2, S3FileSystem)
1267 assert pickle_module.loads(pickle_module.dumps(fs2)) == fs2
1268 assert fs2 != fs
1269
1270 fs = S3FileSystem(anonymous=True)
1271 assert isinstance(fs, S3FileSystem)
1272 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1273
1274 fs = S3FileSystem(background_writes=True)
1275 assert isinstance(fs, S3FileSystem)
1276 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1277
1278 fs2 = S3FileSystem(background_writes=True,
1279 default_metadata={"ACL": "authenticated-read",
1280 "Content-Type": "text/plain"})
1281 assert isinstance(fs2, S3FileSystem)
1282 assert pickle_module.loads(pickle_module.dumps(fs2)) == fs2
1283 assert fs2 != fs
1284
1285 fs = S3FileSystem(allow_delayed_open=True)
1286 assert isinstance(fs, S3FileSystem)
1287 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1288 assert pickle_module.loads(pickle_module.dumps(fs)) != S3FileSystem()
1289
1290 fs = S3FileSystem(allow_bucket_creation=True, allow_bucket_deletion=True)
1291 assert isinstance(fs, S3FileSystem)
1292 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1293
1294 fs = S3FileSystem(allow_bucket_creation=True, allow_bucket_deletion=True,
1295 check_directory_existence_before_creation=True)

Callers

nothing calls this directly

Calls 3

S3FileSystemClass · 0.85
loadsMethod · 0.80
dumpsMethod · 0.80

Tested by

no test coverage detected