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

Function test_gcs_options

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

Source from the content-addressed store, hash-verified

1197
1198@pytest.mark.gcs
1199def test_gcs_options(pickle_with_and_without_subtree_filesystem):
1200 pickle_module = pickle_with_and_without_subtree_filesystem
1201 from pyarrow.fs import GcsFileSystem
1202 dt = datetime.now()
1203 fs = GcsFileSystem(access_token='abc',
1204 target_service_account='service_account@apache',
1205 credential_token_expiration=dt,
1206 default_bucket_location='us-west2',
1207 scheme='https', endpoint_override='localhost:8999',
1208 project_id='test-project-id')
1209 assert isinstance(fs, GcsFileSystem)
1210 assert fs.default_bucket_location == 'us-west2'
1211 assert fs.project_id == 'test-project-id'
1212 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1213
1214 fs = GcsFileSystem()
1215 assert isinstance(fs, GcsFileSystem)
1216 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1217
1218 fs = GcsFileSystem(anonymous=True)
1219 assert isinstance(fs, GcsFileSystem)
1220 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1221
1222 fs = GcsFileSystem(default_metadata={"ACL": "authenticated-read",
1223 "Content-Type": "text/plain"})
1224 assert isinstance(fs, GcsFileSystem)
1225 assert pickle_module.loads(pickle_module.dumps(fs)) == fs
1226
1227 with pytest.raises(ValueError):
1228 GcsFileSystem(access_token='access')
1229 with pytest.raises(ValueError):
1230 GcsFileSystem(anonymous=True, access_token='secret')
1231 with pytest.raises(ValueError):
1232 GcsFileSystem(anonymous=True, target_service_account='acct')
1233 with pytest.raises(ValueError):
1234 GcsFileSystem(credential_token_expiration=datetime.now())
1235
1236
1237@pytest.mark.s3

Callers

nothing calls this directly

Calls 3

GcsFileSystemClass · 0.90
loadsMethod · 0.80
dumpsMethod · 0.80

Tested by

no test coverage detected