Skip to content

Commit

Permalink
CI: Fix botocore Error (#34087)
Browse files Browse the repository at this point in the history
* Update Error Msg

* Fix botocore error

* Add match pattern

* black

* Add AWS Docs & Fix Parquet Test

* Docs

* Docs
  • Loading branch information
alimcmaster1 authored May 9, 2020
1 parent 9ed015f commit 9f746a7
Showing 1 changed file with 17 additions and 6 deletions.
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

0 comments on commit 9f746a7

Please sign in to comment.