Skip to content

Commit 8947750

Browse files
committed
update signatures
1 parent 3bbcf7a commit 8947750

File tree

4 files changed

+51
-28
lines changed

4 files changed

+51
-28
lines changed

pandas/tests/io/excel/test_readers.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -934,29 +934,37 @@ def test_read_from_http_url(self, httpserver, read_ext):
934934

935935
@td.skip_if_not_us_locale
936936
@pytest.mark.single_cpu
937-
def test_read_from_s3_url(self, read_ext, s3_public_bucket, s3so):
938-
# Bucket created in tests/io/conftest.py
937+
def test_read_from_s3_url(self, read_ext, s3_bucket_public):
938+
s3so = {
939+
"client_kwargs": {
940+
"endpoint_url": s3_bucket_public.meta.client.meta.endpoint_url,
941+
}
942+
}
939943
with open("test1" + read_ext, "rb") as f:
940-
s3_public_bucket.put_object(Key="test1" + read_ext, Body=f)
944+
s3_bucket_public.put_object(Key="test1" + read_ext, Body=f)
941945

942-
url = f"s3://{s3_public_bucket.name}/test1" + read_ext
946+
url = f"s3://{s3_bucket_public.name}/test1" + read_ext
943947

944948
url_table = pd.read_excel(url, storage_options=s3so)
945949
local_table = pd.read_excel("test1" + read_ext)
946950
tm.assert_frame_equal(url_table, local_table)
947951

948952
@pytest.mark.single_cpu
949-
def test_read_from_s3_object(self, read_ext, s3_public_bucket, s3so):
953+
def test_read_from_s3_object(self, read_ext, s3_bucket_public):
950954
# GH 38788
951-
# Bucket created in tests/io/conftest.py
955+
s3so = {
956+
"client_kwargs": {
957+
"endpoint_url": s3_bucket_public.meta.client.meta.endpoint_url,
958+
}
959+
}
952960
with open("test1" + read_ext, "rb") as f:
953-
s3_public_bucket.put_object(Key="test1" + read_ext, Body=f)
961+
s3_bucket_public.put_object(Key="test1" + read_ext, Body=f)
954962

955963
import s3fs
956964

957965
s3 = s3fs.S3FileSystem(**s3so)
958966

959-
with s3.open(f"s3://{s3_public_bucket.name}/test1" + read_ext) as f:
967+
with s3.open(f"s3://{s3_bucket_public.name}/test1" + read_ext) as f:
960968
url_table = pd.read_excel(f)
961969

962970
local_table = pd.read_excel("test1" + read_ext)

pandas/tests/io/test_fsspec.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,16 +231,16 @@ def test_fastparquet_options(fsspectest):
231231

232232
@pytest.mark.single_cpu
233233
@pytest.mark.parametrize("compression_suffix", ["", ".gz", ".bz2"])
234-
def test_from_s3_csv(s3_public_bucket_with_data, tips_file, compression_suffix):
234+
def test_from_s3_csv(s3_bucket_public_with_data, tips_file, compression_suffix):
235235
pytest.importorskip("s3fs")
236236

237237
s3so = {
238238
"client_kwargs": {
239-
"endpoint_url": s3_public_bucket_with_data.meta.client.meta.endpoint_url
239+
"endpoint_url": s3_bucket_public_with_data.meta.client.meta.endpoint_url
240240
}
241241
}
242242
df_from_s3 = read_csv(
243-
f"s3://{s3_public_bucket_with_data.name}/tips.csv{compression_suffix}",
243+
f"s3://{s3_bucket_public_with_data.name}/tips.csv{compression_suffix}",
244244
storage_options=s3so,
245245
)
246246
df_from_local = read_csv(tips_file)
@@ -249,16 +249,16 @@ def test_from_s3_csv(s3_public_bucket_with_data, tips_file, compression_suffix):
249249

250250
@pytest.mark.single_cpu
251251
@pytest.mark.parametrize("protocol", ["s3", "s3a", "s3n"])
252-
def test_s3_protocols(s3_public_bucket_with_data, tips_file, protocol):
252+
def test_s3_protocols(s3_bucket_public_with_data, tips_file, protocol):
253253
pytest.importorskip("s3fs")
254254

255255
s3so = {
256256
"client_kwargs": {
257-
"endpoint_url": s3_public_bucket_with_data.meta.client.meta.endpoint_url
257+
"endpoint_url": s3_bucket_public_with_data.meta.client.meta.endpoint_url
258258
}
259259
}
260260
df_from_s3 = read_csv(
261-
f"{protocol}://{s3_public_bucket_with_data.name}/tips.csv",
261+
f"{protocol}://{s3_bucket_public_with_data.name}/tips.csv",
262262
storage_options=s3so,
263263
)
264264
df_from_local = read_csv(tips_file)
@@ -267,14 +267,14 @@ def test_s3_protocols(s3_public_bucket_with_data, tips_file, protocol):
267267

268268
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string) fastparquet")
269269
@pytest.mark.single_cpu
270-
def test_s3_parquet(s3_public_bucket, df1):
270+
def test_s3_parquet(s3_bucket_public, df1):
271271
pytest.importorskip("fastparquet")
272272
pytest.importorskip("s3fs")
273273

274-
fn = f"s3://{s3_public_bucket.name}/test.parquet"
274+
fn = f"s3://{s3_bucket_public.name}/test.parquet"
275275
s3so = {
276276
"client_kwargs": {
277-
"endpoint_url": s3_public_bucket.meta.client.meta.endpoint_url
277+
"endpoint_url": s3_bucket_public.meta.client.meta.endpoint_url
278278
}
279279
}
280280
df1.to_parquet(

pandas/tests/io/test_parquet.py

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -809,34 +809,44 @@ def test_categorical(self, pa):
809809
check_round_trip(df, pa)
810810

811811
@pytest.mark.single_cpu
812-
def test_s3_roundtrip_explicit_fs(self, df_compat, s3_public_bucket, pa, s3so):
812+
def test_s3_roundtrip_explicit_fs(self, df_compat, s3_bucket_public, pa):
813813
s3fs = pytest.importorskip("s3fs")
814+
s3so = {
815+
"client_kwargs": {
816+
"endpoint_url": s3_bucket_public.meta.client.meta.endpoint_url,
817+
}
818+
}
814819
s3 = s3fs.S3FileSystem(**s3so)
815820
kw = {"filesystem": s3}
816821
check_round_trip(
817822
df_compat,
818823
pa,
819-
path=f"{s3_public_bucket.name}/pyarrow.parquet",
824+
path=f"{s3_bucket_public.name}/pyarrow.parquet",
820825
read_kwargs=kw,
821826
write_kwargs=kw,
822827
)
823828

824829
@pytest.mark.single_cpu
825-
def test_s3_roundtrip(self, df_compat, s3_public_bucket, pa, s3so):
830+
def test_s3_roundtrip(self, df_compat, s3_bucket_public, pa):
826831
# GH #19134
832+
s3so = {
833+
"client_kwargs": {
834+
"endpoint_url": s3_bucket_public.meta.client.meta.endpoint_url,
835+
}
836+
}
827837
s3so = {"storage_options": s3so}
828838
check_round_trip(
829839
df_compat,
830840
pa,
831-
path=f"s3://{s3_public_bucket.name}/pyarrow.parquet",
841+
path=f"s3://{s3_bucket_public.name}/pyarrow.parquet",
832842
read_kwargs=s3so,
833843
write_kwargs=s3so,
834844
)
835845

836846
@pytest.mark.single_cpu
837847
@pytest.mark.parametrize("partition_col", [["A"], []])
838848
def test_s3_roundtrip_for_dir(
839-
self, df_compat, s3_public_bucket, pa, partition_col, s3so
849+
self, df_compat, s3_bucket_public, pa, partition_col, s3so
840850
):
841851
pytest.importorskip("s3fs")
842852
# GH #26388
@@ -855,7 +865,7 @@ def test_s3_roundtrip_for_dir(
855865
df_compat,
856866
pa,
857867
expected=expected_df,
858-
path=f"s3://{s3_public_bucket.name}/parquet_dir",
868+
path=f"s3://{s3_bucket_public.name}/parquet_dir",
859869
read_kwargs={"storage_options": s3so},
860870
write_kwargs={
861871
"partition_cols": partition_col,
@@ -1306,12 +1316,17 @@ def test_filter_row_groups(self, fp):
13061316
assert len(result) == 1
13071317

13081318
@pytest.mark.single_cpu
1309-
def test_s3_roundtrip(self, df_compat, s3_public_bucket, fp, s3so):
1319+
def test_s3_roundtrip(self, df_compat, s3_bucket_public, fp):
13101320
# GH #19134
1321+
s3so = {
1322+
"client_kwargs": {
1323+
"endpoint_url": s3_bucket_public.meta.client.meta.endpoint_url,
1324+
}
1325+
}
13111326
check_round_trip(
13121327
df_compat,
13131328
fp,
1314-
path=f"s3://{s3_public_bucket.name}/fastparquet.parquet",
1329+
path=f"s3://{s3_bucket_public.name}/fastparquet.parquet",
13151330
read_kwargs={"storage_options": s3so},
13161331
write_kwargs={"compression": None, "storage_options": s3so},
13171332
)

pandas/tests/io/xml/test_to_xml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,14 +1355,14 @@ def test_unsuported_compression(parser, geom_df):
13551355

13561356

13571357
@pytest.mark.single_cpu
1358-
def test_s3_permission_output(parser, s3_public_bucket, geom_df):
1358+
def test_s3_permission_output(parser, s3_bucket_public, geom_df):
13591359
s3fs = pytest.importorskip("s3fs")
13601360
pytest.importorskip("lxml")
13611361

13621362
with tm.external_error_raised((PermissionError, FileNotFoundError)):
13631363
fs = s3fs.S3FileSystem(anon=True)
1364-
fs.ls(s3_public_bucket.name)
1364+
fs.ls(s3_bucket_public.name)
13651365

13661366
geom_df.to_xml(
1367-
f"s3://{s3_public_bucket.name}/geom.xml", compression="zip", parser=parser
1367+
f"s3://{s3_bucket_public.name}/geom.xml", compression="zip", parser=parser
13681368
)

0 commit comments

Comments
 (0)