Skip to content

Commit

Permalink
fix: Python 3.8 unit tests (#2594)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonLuttenberger authored Jan 10, 2024
1 parent bab6c8b commit 105d444
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import random
import re
import sys
import time
import uuid
from datetime import date, datetime
Expand All @@ -28,6 +29,7 @@

is_ray_modin = wr.engine.get() == EngineEnum.RAY and wr.memory_format.get() == MemoryFormatEnum.MODIN
is_pandas_2_x = False
is_python_3_8_x = sys.version_info.major == 3 and sys.version_info.minor == 8

if is_ray_modin:
from modin.pandas import DataFrame as ModinDataFrame
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/test_s3_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@
import awswrangler as wr
import awswrangler.pandas as pd

from .._utils import is_ray_modin
from .._utils import is_python_3_8_x, is_ray_modin

logging.getLogger("awswrangler").setLevel(logging.DEBUG)

pytestmark = pytest.mark.distributed


@pytest.mark.xfail(
condition=is_python_3_8_x,
reason="Python 3.8 uses older version of Pandas, which doesn't support the usage of index=False with orient='records'",
raises=ValueError,
)
@pytest.mark.parametrize("use_threads", [True, False, 2])
def test_full_table(path, use_threads):
df = pd.DataFrame(
Expand Down
7 changes: 6 additions & 1 deletion tests/unit/test_s3_text_compressed.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import awswrangler as wr
import awswrangler.pandas as pd

from .._utils import get_df_csv, is_ray_modin
from .._utils import get_df_csv, is_python_3_8_x, is_ray_modin

EXT = {"gzip": ".gz", "bz2": ".bz2", "xz": ".xz", "zip": ".zip"}

Expand Down Expand Up @@ -127,6 +127,11 @@ def test_json(path: str, compression: str | None) -> None:
assert df.shape == df2.shape == df3.shape


@pytest.mark.xfail(
condition=is_python_3_8_x,
reason="Python 3.8 uses older version of Pandas, which doesn't support the usage of index=False with orient='records'",
raises=ValueError,
)
@pytest.mark.parametrize("chunksize", [None, 1])
@pytest.mark.parametrize("compression", ["gzip", "bz2", "xz", "zip", None])
def test_partitioned_json(path: str, compression: str | None, chunksize: int | None) -> None:
Expand Down

0 comments on commit 105d444

Please sign in to comment.