Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 4 additions & 13 deletions pandas/tests/io/excel/test_style.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import contextlib
import time
import uuid

import numpy as np
Expand Down Expand Up @@ -324,18 +323,10 @@ def test_styler_to_s3(s3_bucket_public, s3so):
target_file = f"{uuid.uuid4()}.xlsx"
df = DataFrame({"x": [1, 2, 3], "y": [2, 4, 6]})
styler = df.style.set_sticky(axis="index")
styler.to_excel(f"s3://{mock_bucket_name}/{target_file}", storage_options=s3so)
timeout = 5
while True:
if target_file in (obj.key for obj in s3_bucket_public.objects.all()):
break
time.sleep(0.1)
timeout -= 0.1
assert timeout > 0, "Timed out waiting for file to appear on moto"
result = read_excel(
f"s3://{mock_bucket_name}/{target_file}", index_col=0, storage_options=s3so
)
tm.assert_frame_equal(result, df)
uri = f"s3://{mock_bucket_name}/{target_file}"
styler.to_excel(uri, storage_options=s3so)
result = read_excel(uri, index_col=0, storage_options=s3so)
tm.assert_frame_equal(result, df)


@pytest.mark.parametrize("merge_cells", [True, False, "columns"])
Expand Down
13 changes: 4 additions & 9 deletions pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import json
import os
import sys
import time
import uuid

import numpy as np
Expand Down Expand Up @@ -2016,14 +2015,10 @@ def test_to_s3(self, s3_bucket_public, s3so):
mock_bucket_name = s3_bucket_public.name
target_file = f"{uuid.uuid4()}.json"
df = DataFrame({"x": [1, 2, 3], "y": [2, 4, 6]})
df.to_json(f"s3://{mock_bucket_name}/{target_file}", storage_options=s3so)
timeout = 5
while True:
if target_file in (obj.key for obj in s3_bucket_public.objects.all()):
break
time.sleep(0.1)
timeout -= 0.1
assert timeout > 0, "Timed out waiting for file to appear on moto"
uri = f"s3://{mock_bucket_name}/{target_file}"
df.to_json(uri, storage_options=s3so)
result = read_json(uri, storage_options=s3so)
tm.assert_frame_equal(result, df)

def test_json_pandas_nulls(self, nulls_fixture):
# GH 31615
Expand Down
3 changes: 0 additions & 3 deletions pandas/tests/io/test_compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import sys
import tarfile
import textwrap
import time
import zipfile

import numpy as np
Expand Down Expand Up @@ -193,7 +192,6 @@ def test_gzip_reproducibility_file_name(temp_file):
# test for filename
path = temp_file
df.to_csv(path, compression=compression_options)
time.sleep(0.1)
output = path.read_bytes()
df.to_csv(path, compression=compression_options)
assert output == path.read_bytes()
Expand All @@ -216,7 +214,6 @@ def test_gzip_reproducibility_file_object():
buffer = io.BytesIO()
df.to_csv(buffer, compression=compression_options, mode="wb")
output = buffer.getvalue()
time.sleep(0.1)
buffer = io.BytesIO()
df.to_csv(buffer, compression=compression_options, mode="wb")
assert output == buffer.getvalue()
Expand Down
Loading