From 9c20a04c06f44bd5afdc92c23f5dc7f7371130ce Mon Sep 17 00:00:00 2001 From: Leon Luttenberger Date: Tue, 9 Jan 2024 15:18:06 -0600 Subject: [PATCH] fix Python 3.8 unit tests --- tests/_utils.py | 2 ++ tests/unit/test_s3_select.py | 7 ++++++- tests/unit/test_s3_text_compressed.py | 7 ++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/_utils.py b/tests/_utils.py index 5c777e125..63680f4ef 100644 --- a/tests/_utils.py +++ b/tests/_utils.py @@ -3,6 +3,7 @@ import os import random import re +import sys import time import uuid from datetime import date, datetime @@ -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 diff --git a/tests/unit/test_s3_select.py b/tests/unit/test_s3_select.py index 250bf17af..2819e7ce0 100644 --- a/tests/unit/test_s3_select.py +++ b/tests/unit/test_s3_select.py @@ -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( diff --git a/tests/unit/test_s3_text_compressed.py b/tests/unit/test_s3_text_compressed.py index a54056115..7833d4974 100644 --- a/tests/unit/test_s3_text_compressed.py +++ b/tests/unit/test_s3_text_compressed.py @@ -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"} @@ -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: