Skip to content

Commit

Permalink
bug: don't skip arrow tests on macOS (#367)
Browse files Browse the repository at this point in the history
* specify windows platform names

* into a function
  • Loading branch information
EdAbati authored Jul 1, 2024
1 parent 9fd0c29 commit e8449cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
17 changes: 4 additions & 13 deletions tests/expr/test_dt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import sys
from datetime import datetime
from datetime import timedelta
from typing import Any
Expand All @@ -16,6 +15,7 @@
import narwhals as nw
from narwhals.utils import parse_version
from tests.utils import compare_dicts
from tests.utils import is_windows

data = {
"a": [
Expand Down Expand Up @@ -174,10 +174,7 @@ def test_total_minutes(timedeltas: timedelta) -> None:
@pytest.mark.parametrize(
"fmt", ["%Y-%m-%d", "%Y-%m-%d %H:%M:%S", "%Y/%m/%d %H:%M:%S", "%G-W%V-%u", "%G-W%V"]
)
@pytest.mark.skipif(
"win" in sys.platform,
reason="pyarrow breaking on windows",
)
@pytest.mark.skipif(is_windows(), reason="pyarrow breaking on windows")
def test_dt_to_string(constructor: Any, fmt: str) -> None:
input_frame = nw.from_native(constructor(data), eager_only=True)
input_series = input_frame["a"]
Expand Down Expand Up @@ -208,10 +205,7 @@ def test_dt_to_string(constructor: Any, fmt: str) -> None:
(datetime(2020, 1, 9, 12, 34, 56, 123456), "2020-01-09T12:34:56.123456"),
],
)
@pytest.mark.skipif(
"win" in sys.platform,
reason="pyarrow breaking on windows",
)
@pytest.mark.skipif(is_windows(), reason="pyarrow breaking on windows")
def test_dt_to_string_iso_local_datetime(
constructor: Any, data: datetime, expected: str
) -> None:
Expand Down Expand Up @@ -259,10 +253,7 @@ def _clean_string(result: str) -> str:
(datetime(2020, 1, 9), "2020-01-09"),
],
)
@pytest.mark.skipif(
"win" in sys.platform,
reason="pyarrow breaking on windows",
)
@pytest.mark.skipif(is_windows(), reason="pyarrow breaking on windows")
def test_dt_to_string_iso_local_date(
constructor: Any, data: datetime, expected: str
) -> None:
Expand Down
6 changes: 6 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import math
import os
import sys
import warnings
from typing import TYPE_CHECKING
from typing import Any
Expand Down Expand Up @@ -53,3 +54,8 @@ def maybe_get_modin_df(df_pandas: pd.DataFrame) -> Any:
return mpd.DataFrame(df_pandas.to_dict(orient="list"))
else: # pragma: no cover
return df_pandas


def is_windows() -> bool:
"""Check if the current platform is Windows."""
return sys.platform in ["win32", "cygwin"]

0 comments on commit e8449cc

Please sign in to comment.