raulcd commented on code in PR #46078:
URL: https://github.com/apache/arrow/pull/46078#discussion_r2057808472
##########
python/pyarrow/tests/test_fs.py:
##########
@@ -1839,6 +1846,20 @@ def test_s3_real_aws_region_selection():
's3://x-arrow-nonexistent-bucket?region=us-east-3')
assert fs.region == 'us-east-3'
+ # Nonexistent bucket but "allow_delayed_open" delays failure until I/O is
performed
+ fs = S3FileSystem(allow_delayed_open=True, allow_bucket_creation=False)
+ with pytest.raises(IOError, match="AWS Error NO_SUCH_BUCKET"):
+ with fs.open_output_stream("x-arrow-nonexistent-bucket/test.txt") as
stream:
+ stream.write(b"test")
+
+ # Nonexistent bucket. from_uri is not delaying evaluation and raising
OSError
+ # S3FileSystem.from_uri also fails
+ fs, path = FileSystem.from_uri(
+ 's3://x-arrow-nonexistent-bucket/test.txt?allow_delayed_open=true')
+ with pytest.raises(IOError):
+ with fs.open_output_stream(path) as stream:
+ stream.write(b"test")
Review Comment:
Oh! sorry, you are correct, I misunderstood, the test should use an existing
bucket but a non-existent file, right? In this case the instantiation should be
correct but should fail when reading the file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]