From 748432edb4efbeee4b049a4784d6c1b21290f4a8 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Mon, 4 Mar 2024 17:23:44 +0530 Subject: [PATCH 01/32] Create initial Pyodide workflow --- .github/workflows/emscripten.yml | 74 ++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/emscripten.yml diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml new file mode 100644 index 0000000000000..ded71ad31e46c --- /dev/null +++ b/.github/workflows/emscripten.yml @@ -0,0 +1,74 @@ +name: Test Emscripten/Pyodide build + +on: +# TODO: refine when this workflow should run when this +# is ready for use or before merging + pull_request: + push: + workflow_dispatch: + +env: + FORCE_COLOR: 3 + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-wasm-emscripten: + name: Build pandas distribution for Pyodide + runs-on: ubuntu-22.04 + # To enable this workflow on a fork, comment out: + # if: github.repository == 'pandas-dev/pandas' + env: + PYODIDE_VERSION: 0.25.0 + # PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION. + # The appropriate versions can be found in the Pyodide repodata.json + # "info" field, or in Makefile.envs: + # https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2 + PYTHON_VERSION: 3.11.3 + EMSCRIPTEN_VERSION: 3.1.46 + NODE_VERSION: 18 + steps: + - name: Checkout pandas + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python ${{ env.PYTHON_VERSION }} + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Set up Emscripten toolchain + uses: mymindstorm/setup-emsdk@v14 + with: + version: ${{ env.EMSCRIPTEN_VERSION }} + actions-cache-folder: emsdk-cache + + - name: Install pyodide-build + run: pip install "pydantic<2" pyodide-build==${{ env.PYODIDE_VERSION }} + + - name: Build pandas for Pyodide + run: | + # pyodide build -Ceditable-verbose=true + pyodide build + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Set up Pyodide virtual environment + run: | + pyodide venv .venv-pyodide + source .venv-pyodide/bin/activate + pip install dist/*.whl + + - name: Test pandas for Pyodide + run: | + source .venv-pyodide/bin/activate + export PANDAS_CI=1 + pip install pytest + python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas From 05b24001db9e6dced014d37b2eb42783c9126ccd Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:12:49 +0530 Subject: [PATCH 02/32] Do not import pandas folder from the repo --- .github/workflows/emscripten.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index ded71ad31e46c..60ed319188b8d 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -70,5 +70,7 @@ jobs: run: | source .venv-pyodide/bin/activate export PANDAS_CI=1 - pip install pytest - python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas + pip install "pytest<8.1.0" + # do not import pandas from the checked out repo + cd .. + python -c 'import pandas as pd; pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db"])' From f159469c266b6804728a0c5e59f81fac34ad649f Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 17:18:53 +0530 Subject: [PATCH 03/32] Install hypothesis for testing --- .github/workflows/emscripten.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 60ed319188b8d..4af2cb85d471e 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -70,7 +70,7 @@ jobs: run: | source .venv-pyodide/bin/activate export PANDAS_CI=1 - pip install "pytest<8.1.0" + pip install "pytest<8.1.0" hypothesis # do not import pandas from the checked out repo cd .. python -c 'import pandas as pd; pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db"])' From 1713c8664c1b8a007a2815984da251df05d78d32 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:22:56 +0530 Subject: [PATCH 04/32] Add pytest decorator to skip tests on WASM --- pandas/util/_test_decorators.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index 78626781289c4..76b4ad90abcf3 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -25,6 +25,8 @@ def test_foo(): """ from __future__ import annotations +import sys +import platform import locale from typing import ( TYPE_CHECKING, @@ -114,6 +116,10 @@ def skip_if_no(package: str, min_version: str | None = None) -> pytest.MarkDecor locale.getlocale()[0] != "en_US", reason=f"Set local {locale.getlocale()[0]} is not en_US", ) +skip_if_wasm = pytest.mark.skipif( + (sys.platform == "emscripten") or (platform.machine() in ["wasm32", "wasm64"]), + reason="does not support wasm" +) def parametrize_fixture_doc(*args) -> Callable[[F], F]: From 47f48a638fe5e85ffbd2d7e2cfcbde85ad319b82 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:23:09 +0530 Subject: [PATCH 05/32] Skip `time.tzset()` tests on WASM platforms --- pandas/tests/indexes/datetimes/methods/test_normalize.py | 1 + pandas/tests/tools/test_to_datetime.py | 4 +++- pandas/tests/tslibs/test_parsing.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pandas/tests/indexes/datetimes/methods/test_normalize.py b/pandas/tests/indexes/datetimes/methods/test_normalize.py index 74711f67e6446..333c75e433bc9 100644 --- a/pandas/tests/indexes/datetimes/methods/test_normalize.py +++ b/pandas/tests/indexes/datetimes/methods/test_normalize.py @@ -70,6 +70,7 @@ def test_normalize_tz(self): assert not rng.is_normalized @td.skip_if_windows + @td.skip_if_wasm # tzset is available only on Unix-like systems @pytest.mark.parametrize( "timezone", [ diff --git a/pandas/tests/tools/test_to_datetime.py b/pandas/tests/tools/test_to_datetime.py index 42764c121e3d2..4e8a97701467e 100644 --- a/pandas/tests/tools/test_to_datetime.py +++ b/pandas/tests/tools/test_to_datetime.py @@ -975,7 +975,8 @@ def test_to_datetime_now(self): assert pdnow.tzinfo is None assert pdnow2.tzinfo is None - @td.skip_if_windows # `tm.set_timezone` does not work in windows + @td.skip_if_windows # `tm.set_timezone` does not work on Windows + @td.skip_if_wasm # tzset is available only on Unix-like systems @pytest.mark.parametrize("tz", ["Pacific/Auckland", "US/Samoa"]) def test_to_datetime_today(self, tz): # See GH#18666 @@ -1007,6 +1008,7 @@ def test_to_datetime_today_now_unicode_bytes(self, arg): to_datetime([arg]) @pytest.mark.filterwarnings("ignore:Timestamp.utcnow is deprecated:FutureWarning") + @td.skip_if_wasm # tzset is available only on Unix-like systems @pytest.mark.parametrize( "format, expected_ds", [ diff --git a/pandas/tests/tslibs/test_parsing.py b/pandas/tests/tslibs/test_parsing.py index 4dd9d7b20be69..da39a89e38942 100644 --- a/pandas/tests/tslibs/test_parsing.py +++ b/pandas/tests/tslibs/test_parsing.py @@ -24,7 +24,7 @@ import pandas._testing as tm from pandas._testing._hypothesis import DATETIME_NO_TZ - +@td.skip_if_wasm # tzset is available only on Unix-like systems @pytest.mark.skipif( is_platform_windows() or ISMUSL, reason="TZ setting incorrect on Windows and MUSL Linux", From 6cf568eaa6e77d08647b6236cdbb45933c3cbb91 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:54:22 +0530 Subject: [PATCH 06/32] Skip file system access tests on WASM --- pandas/tests/io/parser/common/test_file_buffer_url.py | 1 + pandas/tests/io/parser/test_c_parser_only.py | 1 + pandas/tests/io/test_common.py | 7 ++++++- pandas/tests/io/xml/test_xml.py | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pandas/tests/io/parser/common/test_file_buffer_url.py b/pandas/tests/io/parser/common/test_file_buffer_url.py index b03e31c21fc81..4d63a88582fb8 100644 --- a/pandas/tests/io/parser/common/test_file_buffer_url.py +++ b/pandas/tests/io/parser/common/test_file_buffer_url.py @@ -79,6 +79,7 @@ def test_path_path_lib(all_parsers): tm.assert_frame_equal(df, result) +@td.skip_if_wasm # limited file system access on WASM def test_nonexistent_path(all_parsers): # gh-2428: pls no segfault # gh-14086: raise more helpful FileNotFoundError diff --git a/pandas/tests/io/parser/test_c_parser_only.py b/pandas/tests/io/parser/test_c_parser_only.py index 27d7bc0bb6c07..095e08ba6782d 100644 --- a/pandas/tests/io/parser/test_c_parser_only.py +++ b/pandas/tests/io/parser/test_c_parser_only.py @@ -549,6 +549,7 @@ def test_chunk_whitespace_on_boundary(c_parser_only): tm.assert_frame_equal(result, expected) +@td.skip_if_wasm # limited file system access on WASM def test_file_handles_mmap(c_parser_only, csv1): # gh-14418 # diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index 886bff332a420..bab2cb1dfa93e 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -22,6 +22,7 @@ import pandas as pd import pandas._testing as tm +import pandas.util._test_decorators as td import pandas.io.common as icom @@ -162,6 +163,7 @@ def test_iterator(self): tm.assert_frame_equal(first, expected.iloc[[0]]) tm.assert_frame_equal(pd.concat(it), expected.iloc[1:]) + @td.skip_if_wasm # limited file system access on WASM @pytest.mark.parametrize( "reader, module, error_class, fn_ext", [ @@ -227,6 +229,8 @@ def test_write_missing_parent_directory(self, method, module, error_class, fn_ex ): method(dummy_frame, path) + + @td.skip_if_wasm # limited file system access on WASM @pytest.mark.parametrize( "reader, module, error_class, fn_ext", [ @@ -381,6 +385,7 @@ def mmap_file(datapath): class TestMMapWrapper: + @td.skip_if_wasm # limited file system access on WASM def test_constructor_bad_file(self, mmap_file): non_file = StringIO("I am not a file") non_file.fileno = lambda: -1 @@ -585,7 +590,7 @@ def test_bad_encdoing_errors(): with pytest.raises(LookupError, match="unknown error handler name"): icom.get_handle(path, "w", errors="bad") - +@td.skip_if_wasm # limited file system access on WASM def test_errno_attribute(): # GH 13872 with pytest.raises(FileNotFoundError, match="\\[Errno 2\\]") as err: diff --git a/pandas/tests/io/xml/test_xml.py b/pandas/tests/io/xml/test_xml.py index 97599722cb93f..0c40b47518153 100644 --- a/pandas/tests/io/xml/test_xml.py +++ b/pandas/tests/io/xml/test_xml.py @@ -484,7 +484,7 @@ def test_empty_string_etree(val): with pytest.raises(ParseError, match="no element found"): read_xml(data, parser="etree") - +@td.skip_if_wasm # limited file system access on WASM def test_wrong_file_path(parser): filename = os.path.join("does", "not", "exist", "books.xml") From 9fe190462a4f34ef2342d9ae0cf94b8e9f7310e8 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:04:07 +0530 Subject: [PATCH 07/32] Skip two more tzset test failures --- pandas/tests/scalar/timestamp/test_formats.py | 2 ++ pandas/tests/tools/test_to_datetime.py | 1 + 2 files changed, 3 insertions(+) diff --git a/pandas/tests/scalar/timestamp/test_formats.py b/pandas/tests/scalar/timestamp/test_formats.py index 6a578b0a9eb09..bc179bb1a2d74 100644 --- a/pandas/tests/scalar/timestamp/test_formats.py +++ b/pandas/tests/scalar/timestamp/test_formats.py @@ -6,6 +6,7 @@ import pytz # a test below uses pytz but only inside a `eval` call from pandas import Timestamp +import pandas.util._test_decorators as td ts_no_ns = Timestamp( year=2019, @@ -95,6 +96,7 @@ class TestTimestampRendering: @pytest.mark.parametrize( "date", ["2014-03-07", "2014-01-01 09:00", "2014-01-01 00:00:00.000000001"] ) + @td.skip_if_wasm # tzset is not available in WASM def test_repr(self, date, freq, tz): # avoid to match with timezone name freq_repr = f"'{freq}'" diff --git a/pandas/tests/tools/test_to_datetime.py b/pandas/tests/tools/test_to_datetime.py index 4e8a97701467e..3825b20baf585 100644 --- a/pandas/tests/tools/test_to_datetime.py +++ b/pandas/tests/tools/test_to_datetime.py @@ -959,6 +959,7 @@ def test_to_datetime_YYYYMMDD(self): assert actual == datetime(2008, 1, 15) @td.skip_if_windows # `tm.set_timezone` does not work in windows + @td.skip_if_wasm # tzset is available only on Unix-like systems def test_to_datetime_now(self): # See GH#18666 with tm.set_timezone("US/Eastern"): From 3f07fa9e67cfa46e1973893415ec1babf256dabf Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:15:50 +0530 Subject: [PATCH 08/32] Skip two more FS failures on WASM --- pandas/tests/io/parser/common/test_file_buffer_url.py | 2 ++ pandas/tests/io/test_common.py | 1 + 2 files changed, 3 insertions(+) diff --git a/pandas/tests/io/parser/common/test_file_buffer_url.py b/pandas/tests/io/parser/common/test_file_buffer_url.py index 4d63a88582fb8..782a75caac0ae 100644 --- a/pandas/tests/io/parser/common/test_file_buffer_url.py +++ b/pandas/tests/io/parser/common/test_file_buffer_url.py @@ -93,6 +93,8 @@ def test_nonexistent_path(all_parsers): assert path == e.value.filename +@td.skip_if_wasm # limited file system access on WASM, it leads to different +# error messages than on other platforms @td.skip_if_windows # os.chmod does not work in windows def test_no_permission(all_parsers): # GH 23784 diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index bab2cb1dfa93e..3f7a662fba375 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -408,6 +408,7 @@ def test_constructor_bad_file(self, mmap_file): with pytest.raises(ValueError, match=msg): icom._maybe_memory_map(target, True) + @td.skip_if_wasm # limited file system access on WASM def test_next(self, mmap_file): with open(mmap_file, encoding="utf-8") as target: lines = target.readlines() From bbc88681dbec97fed674c0a581e40507d32c6854 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:50:53 +0530 Subject: [PATCH 09/32] Resolve last two tzset failures on WASM --- pandas/tests/scalar/timestamp/methods/test_replace.py | 2 ++ pandas/tests/scalar/timestamp/methods/test_timestamp_method.py | 1 + 2 files changed, 3 insertions(+) diff --git a/pandas/tests/scalar/timestamp/methods/test_replace.py b/pandas/tests/scalar/timestamp/methods/test_replace.py index d67de79a8dd10..f79960bf1f6df 100644 --- a/pandas/tests/scalar/timestamp/methods/test_replace.py +++ b/pandas/tests/scalar/timestamp/methods/test_replace.py @@ -99,6 +99,7 @@ def test_replace_integer_args(self, tz_aware_fixture): with pytest.raises(ValueError, match=msg): ts.replace(hour=0.1) + @td.skip_if_wasm # tzset is available only on Unix-like systems def test_replace_tzinfo_equiv_tz_localize_none(self): # GH#14621, GH#7825 # assert conversion to naive is the same as replacing tzinfo with None @@ -106,6 +107,7 @@ def test_replace_tzinfo_equiv_tz_localize_none(self): assert ts.tz_localize(None) == ts.replace(tzinfo=None) @td.skip_if_windows + @td.skip_if_wasm # tzset is available only on Unix-like systems def test_replace_tzinfo(self): # GH#15683 dt = datetime(2016, 3, 27, 1) diff --git a/pandas/tests/scalar/timestamp/methods/test_timestamp_method.py b/pandas/tests/scalar/timestamp/methods/test_timestamp_method.py index 67985bd4ba566..60dc5a5e6639c 100644 --- a/pandas/tests/scalar/timestamp/methods/test_timestamp_method.py +++ b/pandas/tests/scalar/timestamp/methods/test_timestamp_method.py @@ -11,6 +11,7 @@ class TestTimestampMethod: @td.skip_if_windows + @td.skip_if_wasm # tzset is available only on Unix-like systems def test_timestamp(self, fixed_now_ts): # GH#17329 # tz-naive --> treat it as if it were UTC for purposes of timestamp() From f049ac29f53c70b9a7f94d92dd43cac2ea5b140f Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 21:04:18 +0530 Subject: [PATCH 10/32] Add a `WASM` constant for Emscripten platform checks --- pandas/compat/__init__.py | 2 ++ pandas/compat/_constants.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 738442fab8c70..c7eeaa5f660bd 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -21,6 +21,7 @@ PY311, PY312, PYPY, + WASM, ) import pandas.compat.compressors from pandas.compat.numpy import is_numpy_dev @@ -192,4 +193,5 @@ def get_bz2_file() -> type[pandas.compat.compressors.BZ2File]: "PY311", "PY312", "PYPY", + "WASM", ] diff --git a/pandas/compat/_constants.py b/pandas/compat/_constants.py index 7bc3fbaaefebf..2625389e5254a 100644 --- a/pandas/compat/_constants.py +++ b/pandas/compat/_constants.py @@ -17,6 +17,7 @@ PY311 = sys.version_info >= (3, 11) PY312 = sys.version_info >= (3, 12) PYPY = platform.python_implementation() == "PyPy" +WASM = (sys.platform == "emscripten") or (platform.machine() in ["wasm32", "wasm64"]) ISMUSL = "musl" in (sysconfig.get_config_var("HOST_GNU_TYPE") or "") REF_COUNT = 2 if PY311 else 3 @@ -27,4 +28,5 @@ "PY311", "PY312", "PYPY", + "WASM", ] From 4d4c0172e96c6650d09f01381cd4ee6f8e6f2426 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 21:04:39 +0530 Subject: [PATCH 11/32] Fix floating point imprecision with `np.timedelta64` --- pandas/tests/io/sas/test_sas7bdat.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/tests/io/sas/test_sas7bdat.py b/pandas/tests/io/sas/test_sas7bdat.py index 889ef61740a2c..69fed85763ca5 100644 --- a/pandas/tests/io/sas/test_sas7bdat.py +++ b/pandas/tests/io/sas/test_sas7bdat.py @@ -7,7 +7,7 @@ import numpy as np import pytest -from pandas.compat import IS64 +from pandas.compat import IS64, WASM from pandas.errors import EmptyDataError import pandas as pd @@ -190,7 +190,7 @@ def test_date_time(datapath): res = df0["DateTimeHi"].astype("M8[us]").dt.round("ms") df0["DateTimeHi"] = res.astype("M8[ms]") - if not IS64: + if (not IS64) or (WASM): # No good reason for this, just what we get on the CI df0.loc[0, "DateTimeHi"] += np.timedelta64(1, "ms") df0.loc[[2, 3], "DateTimeHi"] -= np.timedelta64(1, "ms") @@ -285,7 +285,7 @@ def test_max_sas_date(datapath): columns=["text", "dt_as_float", "dt_as_dt", "date_as_float", "date_as_date"], ) - if not IS64: + if (not IS64) or (WASM): # No good reason for this, just what we get on the CI expected.loc[:, "dt_as_dt"] -= np.timedelta64(1, "ms") @@ -328,7 +328,7 @@ def test_max_sas_date_iterator(datapath): columns=col_order, ), ] - if not IS64: + if (not IS64) or (WASM): # No good reason for this, just what we get on the CI expected[0].loc[0, "dt_as_dt"] -= np.timedelta64(1, "ms") expected[1].loc[0, "dt_as_dt"] -= np.timedelta64(1, "ms") @@ -359,7 +359,7 @@ def test_null_date(datapath): ), }, ) - if not IS64: + if (not IS64) or (WASM): # No good reason for this, just what we get on the CI expected.loc[0, "datetimecol"] -= np.timedelta64(1, "ms") tm.assert_frame_equal(df, expected) From feaac773fafabd2ad53796762e0c7f2d7e708e4c Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 5 Mar 2024 22:33:59 +0530 Subject: [PATCH 12/32] Mark tz OverflowError as xfail on WASM --- pandas/tests/tseries/offsets/test_common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/tseries/offsets/test_common.py b/pandas/tests/tseries/offsets/test_common.py index 3792878973c15..3d1b6b8af1dd6 100644 --- a/pandas/tests/tseries/offsets/test_common.py +++ b/pandas/tests/tseries/offsets/test_common.py @@ -9,6 +9,7 @@ ) from pandas.compat import ( IS64, + WASM, is_platform_windows, ) @@ -130,7 +131,7 @@ def test_apply_out_of_range(request, tz_naive_fixture, _offset): if tz is not None: assert t.tzinfo is not None - if isinstance(tz, tzlocal) and not IS64 and _offset is not DateOffset: + if isinstance(tz, tzlocal) and ((not IS64) or WASM) and _offset is not DateOffset: # If we hit OutOfBoundsDatetime on non-64 bit machines # we'll drop out of the try clause before the next test request.applymarker( From d54d198a3824a6c13150a494b7f4b2af247737aa Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 20 Mar 2024 22:02:56 +0530 Subject: [PATCH 13/32] Try to fix OverflowError with date ranges --- pandas/tests/indexes/datetimes/methods/test_resolution.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/indexes/datetimes/methods/test_resolution.py b/pandas/tests/indexes/datetimes/methods/test_resolution.py index 8399fafbbaff2..5a4d410b343bc 100644 --- a/pandas/tests/indexes/datetimes/methods/test_resolution.py +++ b/pandas/tests/indexes/datetimes/methods/test_resolution.py @@ -1,7 +1,7 @@ from dateutil.tz import tzlocal import pytest -from pandas.compat import IS64 +from pandas.compat import IS64, WASM from pandas import date_range @@ -22,7 +22,7 @@ ) def test_dti_resolution(request, tz_naive_fixture, freq, expected): tz = tz_naive_fixture - if freq == "YE" and not IS64 and isinstance(tz, tzlocal): + if freq == "YE" and ((not IS64) or WASM) and isinstance(tz, tzlocal): request.applymarker( pytest.mark.xfail(reason="OverflowError inside tzlocal past 2038") ) From 294ab6e0aaad3fb93cb0874c8927ac966ca8e29b Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 20 Mar 2024 22:38:06 +0530 Subject: [PATCH 14/32] Move job to unit tests workflow, withdraw env vars --- .github/workflows/emscripten.yml | 76 -------------------------------- .github/workflows/unit-tests.yml | 61 ++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/emscripten.yml diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml deleted file mode 100644 index 4af2cb85d471e..0000000000000 --- a/.github/workflows/emscripten.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Test Emscripten/Pyodide build - -on: -# TODO: refine when this workflow should run when this -# is ready for use or before merging - pull_request: - push: - workflow_dispatch: - -env: - FORCE_COLOR: 3 - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - build-wasm-emscripten: - name: Build pandas distribution for Pyodide - runs-on: ubuntu-22.04 - # To enable this workflow on a fork, comment out: - # if: github.repository == 'pandas-dev/pandas' - env: - PYODIDE_VERSION: 0.25.0 - # PYTHON_VERSION and EMSCRIPTEN_VERSION are determined by PYODIDE_VERSION. - # The appropriate versions can be found in the Pyodide repodata.json - # "info" field, or in Makefile.envs: - # https://github.com/pyodide/pyodide/blob/main/Makefile.envs#L2 - PYTHON_VERSION: 3.11.3 - EMSCRIPTEN_VERSION: 3.1.46 - NODE_VERSION: 18 - steps: - - name: Checkout pandas - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python ${{ env.PYTHON_VERSION }} - id: setup-python - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Set up Emscripten toolchain - uses: mymindstorm/setup-emsdk@v14 - with: - version: ${{ env.EMSCRIPTEN_VERSION }} - actions-cache-folder: emsdk-cache - - - name: Install pyodide-build - run: pip install "pydantic<2" pyodide-build==${{ env.PYODIDE_VERSION }} - - - name: Build pandas for Pyodide - run: | - # pyodide build -Ceditable-verbose=true - pyodide build - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Set up Pyodide virtual environment - run: | - pyodide venv .venv-pyodide - source .venv-pyodide/bin/activate - pip install dist/*.whl - - - name: Test pandas for Pyodide - run: | - source .venv-pyodide/bin/activate - export PANDAS_CI=1 - pip install "pytest<8.1.0" hypothesis - # do not import pandas from the checked out repo - cd .. - python -c 'import pandas as pd; pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db"])' diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 855973a22886a..dfd931cfb7d74 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -328,7 +328,7 @@ jobs: timeout-minutes: 90 concurrency: - #https://github.community/t/concurrecy-not-work-for-push/183068/7 + # https://github.community/t/concurrecy-not-work-for-push/183068/7 group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.os }}-${{ matrix.pytest_target }}-dev cancel-in-progress: true @@ -360,3 +360,62 @@ jobs: - name: Run Tests uses: ./.github/actions/run-tests + + emscripten: + # Note: the Python version, Emscripten toolchain version are determined + # by the Pyodide version. The appropriate versions can be found in the + # Pyodide repodata.json "info" field, or in the Makefile.envs file: + # https://github.com/pyodide/pyodide/blob/stable/Makefile.envs#L2 + # The Node.js version can be determined via Pyodide: + # https://pyodide.org/en/stable/usage/index.html#node-js + name: Build pandas distribution for Pyodide + runs-on: ubuntu-22.04 + concurrency: + # https://github.community/t/concurrecy-not-work-for-push/183068/7 + group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-wasm + cancel-in-progress: true + steps: + - name: Checkout pandas Repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python for Pyodide + id: setup-python + uses: actions/setup-python@v5 + with: + python-version: '3.11.3' + + - name: Set up Emscripten toolchain + uses: mymindstorm/setup-emsdk@v14 + with: + version: '3.1.46' + actions-cache-folder: emsdk-cache + + - name: Install pyodide-build + run: pip install "pydantic<2" "pyodide-build==0.25.0" + + - name: Build pandas for Pyodide + run: | + pyodide build + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Set up Pyodide virtual environment + run: | + pyodide venv .venv-pyodide + source .venv-pyodide/bin/activate + pip install dist/*.whl + + - name: Test pandas for Pyodide + env: + PANDAS_CI: 1 + run: | + source .venv-pyodide/bin/activate + pip install "pytest<8.1.0" hypothesis + # do not import pandas from the checked out repo + cd .. + python -c 'import pandas as pd; pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db"])' From cc233e4c88725440528c1b1aa690843c1d756508 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 20 Mar 2024 22:40:17 +0530 Subject: [PATCH 15/32] Fix up a few style errors, use WASM variable --- pandas/tests/indexes/datetimes/methods/test_resolution.py | 5 ++++- pandas/tests/io/sas/test_sas7bdat.py | 5 ++++- pandas/tests/io/test_common.py | 4 ++-- pandas/tests/io/xml/test_xml.py | 1 + pandas/tests/scalar/timestamp/test_formats.py | 3 ++- pandas/tests/tseries/offsets/test_common.py | 6 +++++- pandas/tests/tslibs/test_parsing.py | 1 + pandas/util/_test_decorators.py | 7 +++---- 8 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pandas/tests/indexes/datetimes/methods/test_resolution.py b/pandas/tests/indexes/datetimes/methods/test_resolution.py index 5a4d410b343bc..93d0b8f557b06 100644 --- a/pandas/tests/indexes/datetimes/methods/test_resolution.py +++ b/pandas/tests/indexes/datetimes/methods/test_resolution.py @@ -1,7 +1,10 @@ from dateutil.tz import tzlocal import pytest -from pandas.compat import IS64, WASM +from pandas.compat import ( + IS64, + WASM, +) from pandas import date_range diff --git a/pandas/tests/io/sas/test_sas7bdat.py b/pandas/tests/io/sas/test_sas7bdat.py index 69fed85763ca5..f009a7822a36c 100644 --- a/pandas/tests/io/sas/test_sas7bdat.py +++ b/pandas/tests/io/sas/test_sas7bdat.py @@ -7,7 +7,10 @@ import numpy as np import pytest -from pandas.compat import IS64, WASM +from pandas.compat import ( + IS64, + WASM, +) from pandas.errors import EmptyDataError import pandas as pd diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index be89b3612d6f5..ae3b7978ef1b7 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -20,10 +20,10 @@ import pytest from pandas.compat import is_platform_windows +import pandas.util._test_decorators as td import pandas as pd import pandas._testing as tm -import pandas.util._test_decorators as td import pandas.io.common as icom @@ -230,7 +230,6 @@ def test_write_missing_parent_directory(self, method, module, error_class, fn_ex ): method(dummy_frame, path) - @td.skip_if_wasm # limited file system access on WASM @pytest.mark.parametrize( "reader, module, error_class, fn_ext", @@ -592,6 +591,7 @@ def test_bad_encdoing_errors(): with pytest.raises(LookupError, match="unknown error handler name"): icom.get_handle(path, "w", errors="bad") + @td.skip_if_wasm # limited file system access on WASM def test_errno_attribute(): # GH 13872 diff --git a/pandas/tests/io/xml/test_xml.py b/pandas/tests/io/xml/test_xml.py index 0c40b47518153..81a86d2c4b23e 100644 --- a/pandas/tests/io/xml/test_xml.py +++ b/pandas/tests/io/xml/test_xml.py @@ -484,6 +484,7 @@ def test_empty_string_etree(val): with pytest.raises(ParseError, match="no element found"): read_xml(data, parser="etree") + @td.skip_if_wasm # limited file system access on WASM def test_wrong_file_path(parser): filename = os.path.join("does", "not", "exist", "books.xml") diff --git a/pandas/tests/scalar/timestamp/test_formats.py b/pandas/tests/scalar/timestamp/test_formats.py index f147c14451e30..8e7bc9d85b2c6 100644 --- a/pandas/tests/scalar/timestamp/test_formats.py +++ b/pandas/tests/scalar/timestamp/test_formats.py @@ -5,9 +5,10 @@ import pytest import pytz # a test below uses pytz but only inside a `eval` call -from pandas import Timestamp import pandas.util._test_decorators as td +from pandas import Timestamp + ts_no_ns = Timestamp( year=2019, month=5, diff --git a/pandas/tests/tseries/offsets/test_common.py b/pandas/tests/tseries/offsets/test_common.py index 3d1b6b8af1dd6..09c9b35485a8a 100644 --- a/pandas/tests/tseries/offsets/test_common.py +++ b/pandas/tests/tseries/offsets/test_common.py @@ -131,7 +131,11 @@ def test_apply_out_of_range(request, tz_naive_fixture, _offset): if tz is not None: assert t.tzinfo is not None - if isinstance(tz, tzlocal) and ((not IS64) or WASM) and _offset is not DateOffset: + if ( + isinstance(tz, tzlocal) + and ((not IS64) or WASM) + and _offset is not DateOffset + ): # If we hit OutOfBoundsDatetime on non-64 bit machines # we'll drop out of the try clause before the next test request.applymarker( diff --git a/pandas/tests/tslibs/test_parsing.py b/pandas/tests/tslibs/test_parsing.py index c3adee41dd689..20f0a61a9292c 100644 --- a/pandas/tests/tslibs/test_parsing.py +++ b/pandas/tests/tslibs/test_parsing.py @@ -25,6 +25,7 @@ import pandas._testing as tm from pandas._testing._hypothesis import DATETIME_NO_TZ + @td.skip_if_wasm # tzset is available only on Unix-like systems @pytest.mark.skipif( is_platform_windows() or ISMUSL, diff --git a/pandas/util/_test_decorators.py b/pandas/util/_test_decorators.py index ae3d6d5668194..48684c4810d2a 100644 --- a/pandas/util/_test_decorators.py +++ b/pandas/util/_test_decorators.py @@ -26,8 +26,6 @@ def test_foo(): from __future__ import annotations -import sys -import platform import locale from typing import ( TYPE_CHECKING, @@ -41,6 +39,7 @@ def test_foo(): from pandas.compat import ( IS64, + WASM, is_platform_windows, ) from pandas.compat._optional import import_optional_dependency @@ -118,8 +117,8 @@ def skip_if_no(package: str, min_version: str | None = None) -> pytest.MarkDecor reason=f"Set local {locale.getlocale()[0]} is not en_US", ) skip_if_wasm = pytest.mark.skipif( - (sys.platform == "emscripten") or (platform.machine() in ["wasm32", "wasm64"]), - reason="does not support wasm" + WASM, + reason="does not support wasm", ) From a944f5287dce1439778f32525ebf5d973e75b817 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Mon, 1 Apr 2024 19:25:11 +0530 Subject: [PATCH 16/32] Bump Pyodide to `0.25.1` See https://github.com/pyodide/pyodide/pull/4654 for more discussion. This commit resolves a build error coming from the `pyodide build` command which broke due to a new `build` release by PyPA. --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 330a70d2feca0..7bee526635584 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -379,7 +379,7 @@ jobs: actions-cache-folder: emsdk-cache - name: Install pyodide-build - run: pip install "pydantic<2" "pyodide-build==0.25.0" + run: pip install "pydantic<2" "pyodide-build==0.25.1" - name: Build pandas for Pyodide run: | From 6ba8636b1285b9d472505f3947cfd9108c3677c5 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 3 May 2024 23:15:09 +0530 Subject: [PATCH 17/32] Use shorter job name --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 7bee526635584..0bcc2cb9840d1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -354,7 +354,7 @@ jobs: # https://github.com/pyodide/pyodide/blob/stable/Makefile.envs#L2 # The Node.js version can be determined via Pyodide: # https://pyodide.org/en/stable/usage/index.html#node-js - name: Build pandas distribution for Pyodide + name: Pyodide build runs-on: ubuntu-22.04 concurrency: # https://github.community/t/concurrecy-not-work-for-push/183068/7 From 75da87fe53012336b41967a8a62383db2eac6bac Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 3 May 2024 23:15:47 +0530 Subject: [PATCH 18/32] Skip test where warning is not raised properly --- pandas/tests/apply/test_str.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandas/tests/apply/test_str.py b/pandas/tests/apply/test_str.py index 50cf0f0ed3e84..a05a8a20001ee 100644 --- a/pandas/tests/apply/test_str.py +++ b/pandas/tests/apply/test_str.py @@ -4,6 +4,8 @@ import numpy as np import pytest +from pandas.compat._constants import WASM + from pandas.core.dtypes.common import is_number from pandas import ( @@ -54,6 +56,7 @@ def test_apply_np_reducer(op, how): tm.assert_series_equal(result, expected) +@pytest.mark.skipif(WASM, reason="No fp exception support in wasm") @pytest.mark.parametrize( "op", ["abs", "ceil", "cos", "cumsum", "exp", "log", "sqrt", "square"] ) From 8c357a320e072126e1c8afde7ee509d7a7db7877 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 3 May 2024 23:18:24 +0530 Subject: [PATCH 19/32] Don't run `test_date_time` loc check on WASM --- pandas/tests/io/sas/test_sas7bdat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/sas/test_sas7bdat.py b/pandas/tests/io/sas/test_sas7bdat.py index f009a7822a36c..088cdb8781f54 100644 --- a/pandas/tests/io/sas/test_sas7bdat.py +++ b/pandas/tests/io/sas/test_sas7bdat.py @@ -193,7 +193,7 @@ def test_date_time(datapath): res = df0["DateTimeHi"].astype("M8[us]").dt.round("ms") df0["DateTimeHi"] = res.astype("M8[ms]") - if (not IS64) or (WASM): + if not IS64: # No good reason for this, just what we get on the CI df0.loc[0, "DateTimeHi"] += np.timedelta64(1, "ms") df0.loc[[2, 3], "DateTimeHi"] -= np.timedelta64(1, "ms") From 2a3270fed57b0bae2cd3a8898d146b5265126ca8 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 3 May 2024 23:19:54 +0530 Subject: [PATCH 20/32] Don't run additional loc checks in `test_sas7bdat` --- pandas/tests/io/sas/test_sas7bdat.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pandas/tests/io/sas/test_sas7bdat.py b/pandas/tests/io/sas/test_sas7bdat.py index 088cdb8781f54..889ef61740a2c 100644 --- a/pandas/tests/io/sas/test_sas7bdat.py +++ b/pandas/tests/io/sas/test_sas7bdat.py @@ -7,10 +7,7 @@ import numpy as np import pytest -from pandas.compat import ( - IS64, - WASM, -) +from pandas.compat import IS64 from pandas.errors import EmptyDataError import pandas as pd @@ -288,7 +285,7 @@ def test_max_sas_date(datapath): columns=["text", "dt_as_float", "dt_as_dt", "date_as_float", "date_as_date"], ) - if (not IS64) or (WASM): + if not IS64: # No good reason for this, just what we get on the CI expected.loc[:, "dt_as_dt"] -= np.timedelta64(1, "ms") @@ -331,7 +328,7 @@ def test_max_sas_date_iterator(datapath): columns=col_order, ), ] - if (not IS64) or (WASM): + if not IS64: # No good reason for this, just what we get on the CI expected[0].loc[0, "dt_as_dt"] -= np.timedelta64(1, "ms") expected[1].loc[0, "dt_as_dt"] -= np.timedelta64(1, "ms") @@ -362,7 +359,7 @@ def test_null_date(datapath): ), }, ) - if (not IS64) or (WASM): + if not IS64: # No good reason for this, just what we get on the CI expected.loc[0, "datetimecol"] -= np.timedelta64(1, "ms") tm.assert_frame_equal(df, expected) From e1002f5cbb2ee6aff854daa9bcf992a0bebeb621 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 3 May 2024 23:43:12 +0530 Subject: [PATCH 21/32] Disable WASM OverflowError --- pandas/tests/tseries/offsets/test_common.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pandas/tests/tseries/offsets/test_common.py b/pandas/tests/tseries/offsets/test_common.py index 09c9b35485a8a..3792878973c15 100644 --- a/pandas/tests/tseries/offsets/test_common.py +++ b/pandas/tests/tseries/offsets/test_common.py @@ -9,7 +9,6 @@ ) from pandas.compat import ( IS64, - WASM, is_platform_windows, ) @@ -131,11 +130,7 @@ def test_apply_out_of_range(request, tz_naive_fixture, _offset): if tz is not None: assert t.tzinfo is not None - if ( - isinstance(tz, tzlocal) - and ((not IS64) or WASM) - and _offset is not DateOffset - ): + if isinstance(tz, tzlocal) and not IS64 and _offset is not DateOffset: # If we hit OutOfBoundsDatetime on non-64 bit machines # we'll drop out of the try clause before the next test request.applymarker( From 13973bb35f28299417d3c7dcdadf7f40538e5166 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 00:19:56 +0530 Subject: [PATCH 22/32] Skip tests requiring fp exception support --- pandas/tests/arithmetic/test_timedelta64.py | 2 ++ pandas/tests/io/parser/test_c_parser_only.py | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/pandas/tests/arithmetic/test_timedelta64.py b/pandas/tests/arithmetic/test_timedelta64.py index 0ecb8f9bef468..6afc31ed7e91b 100644 --- a/pandas/tests/arithmetic/test_timedelta64.py +++ b/pandas/tests/arithmetic/test_timedelta64.py @@ -8,6 +8,7 @@ import numpy as np import pytest +from pandas.compat._constants import WASM from pandas.errors import OutOfBoundsDatetime import pandas as pd @@ -1741,6 +1742,7 @@ def test_td64_div_object_mixed_result(self, box_with_array): # ------------------------------------------------------------------ # __floordiv__, __rfloordiv__ + @pytest.mark.skipif(WASM, reason="no fp exception support in wasm") def test_td64arr_floordiv_td64arr_with_nat(self, box_with_array): # GH#35529 box = box_with_array diff --git a/pandas/tests/io/parser/test_c_parser_only.py b/pandas/tests/io/parser/test_c_parser_only.py index e45cb25c5e35e..96e148b231a9f 100644 --- a/pandas/tests/io/parser/test_c_parser_only.py +++ b/pandas/tests/io/parser/test_c_parser_only.py @@ -18,6 +18,7 @@ import numpy as np import pytest +from pandas.compat._constants import WASM from pandas.compat.numpy import np_version_gte1p24 from pandas.errors import ( ParserError, @@ -94,15 +95,16 @@ def test_dtype_and_names_error(c_parser_only): """ # fallback casting, but not castable warning = RuntimeWarning if np_version_gte1p24 else None - with pytest.raises(ValueError, match="cannot safely convert"): - with tm.assert_produces_warning(warning, check_stacklevel=False): - parser.read_csv( - StringIO(data), - sep=r"\s+", - header=None, - names=["a", "b"], - dtype={"a": np.int32}, - ) + if not WASM: # no fp exception support in wasm + with pytest.raises(ValueError, match="cannot safely convert"): + with tm.assert_produces_warning(warning, check_stacklevel=False): + parser.read_csv( + StringIO(data), + sep=r"\s+", + header=None, + names=["a", "b"], + dtype={"a": np.int32}, + ) @pytest.mark.parametrize( From 24b3e6d2f1f25c6f9399a97b229e8076a6aa2fe9 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 00:20:31 +0530 Subject: [PATCH 23/32] xfail tests that require stricter tolerances --- pandas/tests/io/sas/test_sas7bdat.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandas/tests/io/sas/test_sas7bdat.py b/pandas/tests/io/sas/test_sas7bdat.py index 889ef61740a2c..e310a1496bfa1 100644 --- a/pandas/tests/io/sas/test_sas7bdat.py +++ b/pandas/tests/io/sas/test_sas7bdat.py @@ -7,7 +7,10 @@ import numpy as np import pytest -from pandas.compat import IS64 +from pandas.compat._constants import ( + IS64, + WASM, +) from pandas.errors import EmptyDataError import pandas as pd @@ -253,6 +256,7 @@ def test_corrupt_read(datapath): pd.read_sas(fname) +@pytest.mark.xfail(WASM, reason="failing with currently set tolerances on WASM") def test_max_sas_date(datapath): # GH 20927 # NB. max datetime in SAS dataset is 31DEC9999:23:59:59.999 @@ -292,6 +296,7 @@ def test_max_sas_date(datapath): tm.assert_frame_equal(df, expected) +@pytest.mark.xfail(WASM, reason="failing with currently set tolerances on WASM") def test_max_sas_date_iterator(datapath): # GH 20927 # when called as an iterator, only those chunks with a date > pd.Timestamp.max From dce27054cb2dc16e5cf3c6725540c1d408de7dc4 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 00:21:02 +0530 Subject: [PATCH 24/32] xfail test where `OverflowError`s are received --- pandas/tests/tseries/offsets/test_common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/tests/tseries/offsets/test_common.py b/pandas/tests/tseries/offsets/test_common.py index 3792878973c15..056a1c1e85bea 100644 --- a/pandas/tests/tseries/offsets/test_common.py +++ b/pandas/tests/tseries/offsets/test_common.py @@ -9,6 +9,7 @@ ) from pandas.compat import ( IS64, + WASM, is_platform_windows, ) @@ -106,6 +107,7 @@ def _offset(request): return request.param +@pytest.mark.xfail(WASM, reason="OverflowError received on WASM") def test_apply_out_of_range(request, tz_naive_fixture, _offset): tz = tz_naive_fixture From 7f4715f49b7011de2430f73dadb2acbd38b9421f Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 00:54:18 +0530 Subject: [PATCH 25/32] Remove upper-pin from `pydantic` --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 0bcc2cb9840d1..c90713a8b400b 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -379,7 +379,7 @@ jobs: actions-cache-folder: emsdk-cache - name: Install pyodide-build - run: pip install "pydantic<2" "pyodide-build==0.25.1" + run: pip install "pyodide-build==0.25.1" - name: Build pandas for Pyodide run: | From 9f465280a0b91ca7a180b1b8e894d5a4b7b77c1f Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 01:06:15 +0530 Subject: [PATCH 26/32] Better skip messages via `pytest.skipif` decorator --- .../indexes/datetimes/methods/test_normalize.py | 3 ++- .../io/parser/common/test_file_buffer_url.py | 6 +++--- pandas/tests/io/parser/test_c_parser_only.py | 4 ++-- pandas/tests/io/test_common.py | 16 +++++++++------- pandas/tests/io/xml/test_xml.py | 3 ++- .../scalar/timestamp/methods/test_replace.py | 5 +++-- .../timestamp/methods/test_timestamp_method.py | 4 +++- pandas/tests/scalar/timestamp/test_formats.py | 4 ++-- pandas/tests/tools/test_to_datetime.py | 7 ++++--- pandas/tests/tslibs/test_parsing.py | 3 ++- 10 files changed, 32 insertions(+), 23 deletions(-) diff --git a/pandas/tests/indexes/datetimes/methods/test_normalize.py b/pandas/tests/indexes/datetimes/methods/test_normalize.py index 333c75e433bc9..0adca7a62956f 100644 --- a/pandas/tests/indexes/datetimes/methods/test_normalize.py +++ b/pandas/tests/indexes/datetimes/methods/test_normalize.py @@ -2,6 +2,7 @@ import numpy as np import pytest +from pandas.compat import WASM import pandas.util._test_decorators as td from pandas import ( @@ -70,7 +71,7 @@ def test_normalize_tz(self): assert not rng.is_normalized @td.skip_if_windows - @td.skip_if_wasm # tzset is available only on Unix-like systems + @pytest.mark.skipif(WASM, "tzset is available only on Unix-like systems, not WASM") @pytest.mark.parametrize( "timezone", [ diff --git a/pandas/tests/io/parser/common/test_file_buffer_url.py b/pandas/tests/io/parser/common/test_file_buffer_url.py index fb9632bb3f049..ba31a9bc15fb5 100644 --- a/pandas/tests/io/parser/common/test_file_buffer_url.py +++ b/pandas/tests/io/parser/common/test_file_buffer_url.py @@ -15,6 +15,7 @@ import numpy as np import pytest +from pandas.compat import WASM from pandas.errors import ( EmptyDataError, ParserError, @@ -80,7 +81,7 @@ def test_path_path_lib(all_parsers): tm.assert_frame_equal(df, result) -@td.skip_if_wasm # limited file system access on WASM +@pytest.mark.skipif(WASM, reason="limited file system access on WASM") def test_nonexistent_path(all_parsers): # gh-2428: pls no segfault # gh-14086: raise more helpful FileNotFoundError @@ -94,8 +95,7 @@ def test_nonexistent_path(all_parsers): assert path == e.value.filename -@td.skip_if_wasm # limited file system access on WASM, it leads to different -# error messages than on other platforms +@pytest.mark.skipif(WASM, reason="limited file system access on WASM") @td.skip_if_windows # os.chmod does not work in windows def test_no_permission(all_parsers): # GH 23784 diff --git a/pandas/tests/io/parser/test_c_parser_only.py b/pandas/tests/io/parser/test_c_parser_only.py index 96e148b231a9f..ab2e1ee138315 100644 --- a/pandas/tests/io/parser/test_c_parser_only.py +++ b/pandas/tests/io/parser/test_c_parser_only.py @@ -18,7 +18,7 @@ import numpy as np import pytest -from pandas.compat._constants import WASM +from pandas.compat import WASM from pandas.compat.numpy import np_version_gte1p24 from pandas.errors import ( ParserError, @@ -552,7 +552,7 @@ def test_chunk_whitespace_on_boundary(c_parser_only): tm.assert_frame_equal(result, expected) -@td.skip_if_wasm # limited file system access on WASM +@pytest.mark.skipif(WASM, reason="limited file system access on WASM") def test_file_handles_mmap(c_parser_only, csv1): # gh-14418 # diff --git a/pandas/tests/io/test_common.py b/pandas/tests/io/test_common.py index a3a18e2903e53..e4b4d3a82669d 100644 --- a/pandas/tests/io/test_common.py +++ b/pandas/tests/io/test_common.py @@ -19,8 +19,10 @@ import numpy as np import pytest -from pandas.compat import is_platform_windows -import pandas.util._test_decorators as td +from pandas.compat import ( + WASM, + is_platform_windows, +) import pandas as pd import pandas._testing as tm @@ -164,7 +166,7 @@ def test_iterator(self): tm.assert_frame_equal(first, expected.iloc[[0]]) tm.assert_frame_equal(pd.concat(it), expected.iloc[1:]) - @td.skip_if_wasm # limited file system access on WASM + @pytest.mark.skipif(WASM, reason="limited file system access on WASM") @pytest.mark.parametrize( "reader, module, error_class, fn_ext", [ @@ -230,7 +232,7 @@ def test_write_missing_parent_directory(self, method, module, error_class, fn_ex ): method(dummy_frame, path) - @td.skip_if_wasm # limited file system access on WASM + @pytest.mark.skipif(WASM, reason="limited file system access on WASM") @pytest.mark.parametrize( "reader, module, error_class, fn_ext", [ @@ -385,7 +387,7 @@ def mmap_file(datapath): class TestMMapWrapper: - @td.skip_if_wasm # limited file system access on WASM + @pytest.mark.skipif(WASM, reason="limited file system access on WASM") def test_constructor_bad_file(self, mmap_file): non_file = StringIO("I am not a file") non_file.fileno = lambda: -1 @@ -408,7 +410,7 @@ def test_constructor_bad_file(self, mmap_file): with pytest.raises(ValueError, match=msg): icom._maybe_memory_map(target, True) - @td.skip_if_wasm # limited file system access on WASM + @pytest.mark.skipif(WASM, reason="limited file system access on WASM") def test_next(self, mmap_file): with open(mmap_file, encoding="utf-8") as target: lines = target.readlines() @@ -592,7 +594,7 @@ def test_bad_encdoing_errors(): icom.get_handle(path, "w", errors="bad") -@td.skip_if_wasm # limited file system access on WASM +@pytest.mark.skipif(WASM, reason="limited file system access on WASM") def test_errno_attribute(): # GH 13872 with pytest.raises(FileNotFoundError, match="\\[Errno 2\\]") as err: diff --git a/pandas/tests/io/xml/test_xml.py b/pandas/tests/io/xml/test_xml.py index 81a86d2c4b23e..357e6129dd8f1 100644 --- a/pandas/tests/io/xml/test_xml.py +++ b/pandas/tests/io/xml/test_xml.py @@ -14,6 +14,7 @@ import numpy as np import pytest +from pandas.compat import WASM from pandas.compat._optional import import_optional_dependency from pandas.errors import ( EmptyDataError, @@ -485,7 +486,7 @@ def test_empty_string_etree(val): read_xml(data, parser="etree") -@td.skip_if_wasm # limited file system access on WASM +@pytest.mark.skipif(WASM, reason="limited file system access on WASM") def test_wrong_file_path(parser): filename = os.path.join("does", "not", "exist", "books.xml") diff --git a/pandas/tests/scalar/timestamp/methods/test_replace.py b/pandas/tests/scalar/timestamp/methods/test_replace.py index f79960bf1f6df..c5169fdff0cd4 100644 --- a/pandas/tests/scalar/timestamp/methods/test_replace.py +++ b/pandas/tests/scalar/timestamp/methods/test_replace.py @@ -11,6 +11,7 @@ conversion, ) from pandas._libs.tslibs.dtypes import NpyDatetimeUnit +from pandas.compat import WASM import pandas.util._test_decorators as td import pandas._testing as tm @@ -99,7 +100,7 @@ def test_replace_integer_args(self, tz_aware_fixture): with pytest.raises(ValueError, match=msg): ts.replace(hour=0.1) - @td.skip_if_wasm # tzset is available only on Unix-like systems + @pytest.mark.skipif(WASM, reason="tzset is not available on WASM") def test_replace_tzinfo_equiv_tz_localize_none(self): # GH#14621, GH#7825 # assert conversion to naive is the same as replacing tzinfo with None @@ -107,7 +108,7 @@ def test_replace_tzinfo_equiv_tz_localize_none(self): assert ts.tz_localize(None) == ts.replace(tzinfo=None) @td.skip_if_windows - @td.skip_if_wasm # tzset is available only on Unix-like systems + @pytest.mark.skipif(WASM, reason="tzset is not available on WASM") def test_replace_tzinfo(self): # GH#15683 dt = datetime(2016, 3, 27, 1) diff --git a/pandas/tests/scalar/timestamp/methods/test_timestamp_method.py b/pandas/tests/scalar/timestamp/methods/test_timestamp_method.py index 60dc5a5e6639c..b576317fca8b4 100644 --- a/pandas/tests/scalar/timestamp/methods/test_timestamp_method.py +++ b/pandas/tests/scalar/timestamp/methods/test_timestamp_method.py @@ -1,9 +1,11 @@ # NB: This is for the Timestamp.timestamp *method* specifically, not # the Timestamp class in general. +import pytest from pytz import utc from pandas._libs.tslibs import Timestamp +from pandas.compat import WASM import pandas.util._test_decorators as td import pandas._testing as tm @@ -11,7 +13,7 @@ class TestTimestampMethod: @td.skip_if_windows - @td.skip_if_wasm # tzset is available only on Unix-like systems + @pytest.mark.skipif(WASM, reason="tzset is not available on WASM") def test_timestamp(self, fixed_now_ts): # GH#17329 # tz-naive --> treat it as if it were UTC for purposes of timestamp() diff --git a/pandas/tests/scalar/timestamp/test_formats.py b/pandas/tests/scalar/timestamp/test_formats.py index b3c7211f531af..44db1187850c9 100644 --- a/pandas/tests/scalar/timestamp/test_formats.py +++ b/pandas/tests/scalar/timestamp/test_formats.py @@ -5,7 +5,7 @@ import pytest import pytz # a test below uses pytz but only inside a `eval` call -import pandas.util._test_decorators as td +from pandas.compat import WASM from pandas import Timestamp @@ -97,7 +97,7 @@ class TestTimestampRendering: @pytest.mark.parametrize( "date", ["2014-03-07", "2014-01-01 09:00", "2014-01-01 00:00:00.000000001"] ) - @td.skip_if_wasm # tzset is not available in WASM + @pytest.mark.skipif(WASM, reason="tzset is not available on WASM") def test_repr(self, date, freq, tz): # avoid to match with timezone name freq_repr = f"'{freq}'" diff --git a/pandas/tests/tools/test_to_datetime.py b/pandas/tests/tools/test_to_datetime.py index 621379852d3ca..b05c30fa50fbe 100644 --- a/pandas/tests/tools/test_to_datetime.py +++ b/pandas/tests/tools/test_to_datetime.py @@ -21,6 +21,7 @@ iNaT, parsing, ) +from pandas.compat import WASM from pandas.errors import ( OutOfBoundsDatetime, OutOfBoundsTimedelta, @@ -959,7 +960,7 @@ def test_to_datetime_YYYYMMDD(self): assert actual == datetime(2008, 1, 15) @td.skip_if_windows # `tm.set_timezone` does not work in windows - @td.skip_if_wasm # tzset is available only on Unix-like systems + @pytest.mark.skipif(WASM, reason="tzset is not available on WASM") def test_to_datetime_now(self): # See GH#18666 with tm.set_timezone("US/Eastern"): @@ -977,7 +978,7 @@ def test_to_datetime_now(self): assert pdnow2.tzinfo is None @td.skip_if_windows # `tm.set_timezone` does not work on Windows - @td.skip_if_wasm # tzset is available only on Unix-like systems + @pytest.mark.skipif(WASM, reason="tzset is not available on WASM") @pytest.mark.parametrize("tz", ["Pacific/Auckland", "US/Samoa"]) def test_to_datetime_today(self, tz): # See GH#18666 @@ -1009,7 +1010,7 @@ def test_to_datetime_today_now_unicode_bytes(self, arg): to_datetime([arg]) @pytest.mark.filterwarnings("ignore:Timestamp.utcnow is deprecated:FutureWarning") - @td.skip_if_wasm # tzset is available only on Unix-like systems + @pytest.mark.skipif(WASM, reason="tzset is not available on WASM") @pytest.mark.parametrize( "format, expected_ds", [ diff --git a/pandas/tests/tslibs/test_parsing.py b/pandas/tests/tslibs/test_parsing.py index 174e1a86cfdff..9b64beaf09273 100644 --- a/pandas/tests/tslibs/test_parsing.py +++ b/pandas/tests/tslibs/test_parsing.py @@ -17,6 +17,7 @@ from pandas._libs.tslibs.parsing import parse_datetime_string_with_reso from pandas.compat import ( ISMUSL, + WASM, is_platform_windows, ) import pandas.util._test_decorators as td @@ -29,7 +30,7 @@ from pandas._testing._hypothesis import DATETIME_NO_TZ -@td.skip_if_wasm # tzset is available only on Unix-like systems +@pytest.mark.skipif(WASM, reason="tzset is not available on WASM") @pytest.mark.skipif( is_platform_windows() or ISMUSL, reason="TZ setting incorrect on Windows and MUSL Linux", From 51f88930c5de28d839466e2701eef73e12cb98b3 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 01:06:55 +0530 Subject: [PATCH 27/32] Import `WASM` var via public API where possible --- pandas/tests/apply/test_str.py | 2 +- pandas/tests/arithmetic/test_timedelta64.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/tests/apply/test_str.py b/pandas/tests/apply/test_str.py index a05a8a20001ee..aeece1c0d3de0 100644 --- a/pandas/tests/apply/test_str.py +++ b/pandas/tests/apply/test_str.py @@ -4,7 +4,7 @@ import numpy as np import pytest -from pandas.compat._constants import WASM +from pandas.compat import WASM from pandas.core.dtypes.common import is_number diff --git a/pandas/tests/arithmetic/test_timedelta64.py b/pandas/tests/arithmetic/test_timedelta64.py index 6afc31ed7e91b..4583155502374 100644 --- a/pandas/tests/arithmetic/test_timedelta64.py +++ b/pandas/tests/arithmetic/test_timedelta64.py @@ -8,7 +8,7 @@ import numpy as np import pytest -from pandas.compat._constants import WASM +from pandas.compat import WASM from pandas.errors import OutOfBoundsDatetime import pandas as pd From ab911d1b32bca21b48872024d60dae54d5844be5 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 01:19:59 +0530 Subject: [PATCH 28/32] Unpin `pytest` for Pyodide job --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index c90713a8b400b..1b88d4d90d3e1 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -401,7 +401,7 @@ jobs: PANDAS_CI: 1 run: | source .venv-pyodide/bin/activate - pip install "pytest<8.1.0" hypothesis + pip install pytest hypothesis # do not import pandas from the checked out repo cd .. python -c 'import pandas as pd; pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db"])' From 7371f64341baa9aab8088893023ae8ec7003c900 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 02:05:17 +0530 Subject: [PATCH 29/32] Add reason attr when using boolean to skip test --- pandas/tests/indexes/datetimes/methods/test_normalize.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/tests/indexes/datetimes/methods/test_normalize.py b/pandas/tests/indexes/datetimes/methods/test_normalize.py index 0adca7a62956f..0ce28d60b53b9 100644 --- a/pandas/tests/indexes/datetimes/methods/test_normalize.py +++ b/pandas/tests/indexes/datetimes/methods/test_normalize.py @@ -71,7 +71,9 @@ def test_normalize_tz(self): assert not rng.is_normalized @td.skip_if_windows - @pytest.mark.skipif(WASM, "tzset is available only on Unix-like systems, not WASM") + @pytest.mark.skipif( + WASM, reason="tzset is available only on Unix-like systems, not WASM" + ) @pytest.mark.parametrize( "timezone", [ From ef7a3abcdbce664f2e63eef8f4557f3a32805115 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 02:43:49 +0530 Subject: [PATCH 30/32] Don't xfail, skip tests that bring `OverflowError`s --- pandas/tests/indexes/datetimes/methods/test_resolution.py | 1 + pandas/tests/tseries/offsets/test_common.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pandas/tests/indexes/datetimes/methods/test_resolution.py b/pandas/tests/indexes/datetimes/methods/test_resolution.py index 93d0b8f557b06..42c3ab0617b7c 100644 --- a/pandas/tests/indexes/datetimes/methods/test_resolution.py +++ b/pandas/tests/indexes/datetimes/methods/test_resolution.py @@ -23,6 +23,7 @@ ("us", "microsecond"), ], ) +@pytest.mark.skipif(WASM, reason="OverflowError received on WASM") def test_dti_resolution(request, tz_naive_fixture, freq, expected): tz = tz_naive_fixture if freq == "YE" and ((not IS64) or WASM) and isinstance(tz, tzlocal): diff --git a/pandas/tests/tseries/offsets/test_common.py b/pandas/tests/tseries/offsets/test_common.py index 056a1c1e85bea..34181f28bb1a0 100644 --- a/pandas/tests/tseries/offsets/test_common.py +++ b/pandas/tests/tseries/offsets/test_common.py @@ -107,7 +107,7 @@ def _offset(request): return request.param -@pytest.mark.xfail(WASM, reason="OverflowError received on WASM") +@pytest.mark.skipif(WASM, reason="OverflowError received on WASM") def test_apply_out_of_range(request, tz_naive_fixture, _offset): tz = tz_naive_fixture @@ -132,7 +132,11 @@ def test_apply_out_of_range(request, tz_naive_fixture, _offset): if tz is not None: assert t.tzinfo is not None - if isinstance(tz, tzlocal) and not IS64 and _offset is not DateOffset: + if ( + isinstance(tz, tzlocal) + and ((not IS64) or WASM) + and _offset is not DateOffset + ): # If we hit OutOfBoundsDatetime on non-64 bit machines # we'll drop out of the try clause before the next test request.applymarker( From c089852aad05f01eb3cf2e6b650a082005e8b8af Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 03:32:49 +0530 Subject: [PATCH 31/32] Skip timedelta test that runs well only on 64-bit --- pandas/tests/tools/test_to_timedelta.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandas/tests/tools/test_to_timedelta.py b/pandas/tests/tools/test_to_timedelta.py index c052ca58f5873..ba000a0439dd1 100644 --- a/pandas/tests/tools/test_to_timedelta.py +++ b/pandas/tests/tools/test_to_timedelta.py @@ -6,7 +6,10 @@ import numpy as np import pytest -from pandas.compat import IS64 +from pandas.compat import ( + IS64, + WASM, +) from pandas.errors import OutOfBoundsTimedelta import pandas as pd @@ -214,6 +217,7 @@ def test_to_timedelta_on_missing_values_list(self, val): actual = to_timedelta([val]) assert actual[0]._value == np.timedelta64("NaT").astype("int64") + @pytest.mark.skipif(WASM, reason="No fp exception support in WASM") @pytest.mark.xfail(not IS64, reason="Floating point error") def test_to_timedelta_float(self): # https://github.com/pandas-dev/pandas/issues/25077 From 6a907c1ebe9532e6007aa703a9aad98a5fce1826 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 4 May 2024 03:38:03 +0530 Subject: [PATCH 32/32] Skip tests that use `np.timedelta64` --- pandas/tests/io/sas/test_sas7bdat.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/tests/io/sas/test_sas7bdat.py b/pandas/tests/io/sas/test_sas7bdat.py index e310a1496bfa1..fc5df6d9babcb 100644 --- a/pandas/tests/io/sas/test_sas7bdat.py +++ b/pandas/tests/io/sas/test_sas7bdat.py @@ -171,6 +171,7 @@ def test_airline(datapath): tm.assert_frame_equal(df, df0) +@pytest.mark.skipif(WASM, reason="Pyodide/WASM has 32-bitness") def test_date_time(datapath): # Support of different SAS date/datetime formats (PR #15871) fname = datapath("io", "sas", "data", "datetime.sas7bdat") @@ -342,6 +343,7 @@ def test_max_sas_date_iterator(datapath): tm.assert_frame_equal(results[1], expected[1]) +@pytest.mark.skipif(WASM, reason="Pyodide/WASM has 32-bitness") def test_null_date(datapath): fname = datapath("io", "sas", "data", "dates_null.sas7bdat") df = pd.read_sas(fname, encoding="utf-8")