Skip to content

Commit e308bf8

Browse files
committed
Add with Creds Test
1 parent 07394f4 commit e308bf8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pandas/tests/io/test_s3.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from io import BytesIO
2+
import os
23

34
import pytest
45

@@ -35,3 +36,21 @@ def test_read_without_creds_from_pub_bucket():
3536
# Use Amazon Open Data Registry - https://registry.opendata.aws/gdelt
3637
result = read_csv("s3://gdelt-open-data/events/1981.csv", nrows=3)
3738
assert len(result) == 3
39+
40+
41+
@tm.network
42+
@td.skip_if_no("s3fs")
43+
def test_read_with_creds_from_pub_bucke():
44+
# Ensure we can read from a public bucket with credentials
45+
# GH 34626
46+
# Use Amazon Open Data Registry - https://registry.opendata.aws/gdelt
47+
48+
with tm.ensure_safe_environment_variables():
49+
# temporary workaround as moto fails for botocore >= 1.11 otherwise,
50+
# see https://github.com/spulec/moto/issues/1924 & 1952
51+
os.environ.setdefault("AWS_ACCESS_KEY_ID", "foobar_key")
52+
os.environ.setdefault("AWS_SECRET_ACCESS_KEY", "foobar_secret")
53+
df = read_csv(
54+
"s3://gdelt-open-data/events/1981.csv", nrows=5, sep="\t", header=None,
55+
)
56+
assert len(df) == 5

0 commit comments

Comments
 (0)