Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions pandas/tests/io/parser/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,28 @@ def test_read_s3_fails(self):
def test_write_s3_csv_fails(self, tips_df):
# GH 32486
# Attempting to write to an invalid S3 path should raise
with pytest.raises(
FileNotFoundError, match="The specified bucket does not exist"
):
import botocore

# GH 34087
# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/error-handling.html
# Catch a ClientError since AWS Service Errors are defined dynamically
error = (FileNotFoundError, botocore.exceptions.ClientError)

with pytest.raises(error, match="The specified bucket does not exist"):
tips_df.to_csv("s3://an_s3_bucket_data_doesnt_exit/not_real.csv")

@td.skip_if_no("pyarrow")
def test_write_s3_parquet_fails(self, tips_df):
# GH 27679
with pytest.raises(
FileNotFoundError, match="The specified bucket does not exist"
):
# Attempting to write to an invalid S3 path should raise
import botocore

# GH 34087
# https://boto3.amazonaws.com/v1/documentation/api/latest/guide/error-handling.html
# Catch a ClientError since AWS Service Errors are defined dynamically
error = (FileNotFoundError, botocore.exceptions.ClientError)

with pytest.raises(error, match="The specified bucket does not exist"):
tips_df.to_parquet("s3://an_s3_bucket_data_doesnt_exit/not_real.parquet")

def test_read_csv_handles_boto_s3_object(self, s3_resource, tips_file):
Expand Down