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

Function test_s3fs_wrong_region

python/pyarrow/tests/test_fs.py:1485–1505  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1483
1484@pytest.mark.s3
1485def test_s3fs_wrong_region():
1486 from pyarrow.fs import S3FileSystem
1487
1488 # wrong region for bucket
1489 # anonymous=True incase CI/etc has invalid credentials
1490 fs = S3FileSystem(region='eu-north-1', anonymous=True)
1491
1492 msg = ("When getting information for bucket 'arrow-datasets': "
1493 r"AWS Error UNKNOWN \(HTTP status 301\) during HeadBucket "
1494 "operation: No response body. Looks like the configured region is "
1495 "'eu-north-1' while the bucket is located in 'us-east-1'."
1496 "|NETWORK_CONNECTION")
1497 with pytest.raises(OSError, match=msg) as exc:
1498 fs.get_file_info("arrow-datasets")
1499
1500 # Sometimes fails on unrelated network error, so next call would also fail.
1501 if 'NETWORK_CONNECTION' in str(exc.value):
1502 return
1503
1504 fs = S3FileSystem(region='us-east-1', anonymous=True)
1505 fs.get_file_info("arrow-datasets")
1506
1507
1508@pytest.mark.azure

Callers

nothing calls this directly

Calls 2

S3FileSystemClass · 0.85
get_file_infoMethod · 0.45

Tested by

no test coverage detected