From 36d2e98c036f7710bd56f4a467cc7111ccc4f4ee Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:29:24 -0800 Subject: [PATCH 1/7] TST: Skip flaky offset test case on WASM --- .../tests/tseries/offsets/test_offsets_properties.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pandas/tests/tseries/offsets/test_offsets_properties.py b/pandas/tests/tseries/offsets/test_offsets_properties.py index 943434e515828..4fec32ba3a943 100644 --- a/pandas/tests/tseries/offsets/test_offsets_properties.py +++ b/pandas/tests/tseries/offsets/test_offsets_properties.py @@ -14,6 +14,8 @@ ) import pytest +from pandas.compat import WASM + import pandas as pd from pandas._testing._hypothesis import ( DATETIME_JAN_1_1900_OPTIONAL_TZ, @@ -28,6 +30,14 @@ @given(DATETIME_JAN_1_1900_OPTIONAL_TZ, YQM_OFFSET) def test_on_offset_implementations(dt, offset): assume(not offset.normalize) + # This case is flaky in CI 2024-11-04 + assume( + not ( + WASM + and dt.tzinfo.key == "Indian/Cocos" + and isinstance(offset, pd.offsets.MonthBegin) + ) + ) # check that the class-specific implementations of is_on_offset match # the general case definition: # (dt + offset) - offset == dt From 418a94adf5bcddc0a6eee000d20d2ee094541898 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:10:05 -0800 Subject: [PATCH 2/7] Check tzinfo exists --- pandas/tests/tseries/offsets/test_offsets_properties.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/tests/tseries/offsets/test_offsets_properties.py b/pandas/tests/tseries/offsets/test_offsets_properties.py index 4fec32ba3a943..51416ef612d7c 100644 --- a/pandas/tests/tseries/offsets/test_offsets_properties.py +++ b/pandas/tests/tseries/offsets/test_offsets_properties.py @@ -34,6 +34,7 @@ def test_on_offset_implementations(dt, offset): assume( not ( WASM + and dt.tzinfo is not None and dt.tzinfo.key == "Indian/Cocos" and isinstance(offset, pd.offsets.MonthBegin) ) From 350ff7278fa758d6b4fba3d3f653e1403ef59357 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 4 Nov 2024 10:41:23 -0800 Subject: [PATCH 3/7] Check for zoneinfo directly --- pandas/tests/tseries/offsets/test_offsets_properties.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/tests/tseries/offsets/test_offsets_properties.py b/pandas/tests/tseries/offsets/test_offsets_properties.py index 51416ef612d7c..809d8f87b2c02 100644 --- a/pandas/tests/tseries/offsets/test_offsets_properties.py +++ b/pandas/tests/tseries/offsets/test_offsets_properties.py @@ -8,6 +8,8 @@ tests, or when trying to pin down the bugs exposed by the tests below. """ +import zoneinfo + from hypothesis import ( assume, given, @@ -34,7 +36,7 @@ def test_on_offset_implementations(dt, offset): assume( not ( WASM - and dt.tzinfo is not None + and isinstance(dt.tzinfo, zoneinfo.ZoneInfo) and dt.tzinfo.key == "Indian/Cocos" and isinstance(offset, pd.offsets.MonthBegin) ) From 5bc727258e669050cb0b30e2d652fbd85e86e8da Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:27:10 -0800 Subject: [PATCH 4/7] Undo original change --- .../tseries/offsets/test_offsets_properties.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/pandas/tests/tseries/offsets/test_offsets_properties.py b/pandas/tests/tseries/offsets/test_offsets_properties.py index 809d8f87b2c02..943434e515828 100644 --- a/pandas/tests/tseries/offsets/test_offsets_properties.py +++ b/pandas/tests/tseries/offsets/test_offsets_properties.py @@ -8,16 +8,12 @@ tests, or when trying to pin down the bugs exposed by the tests below. """ -import zoneinfo - from hypothesis import ( assume, given, ) import pytest -from pandas.compat import WASM - import pandas as pd from pandas._testing._hypothesis import ( DATETIME_JAN_1_1900_OPTIONAL_TZ, @@ -32,15 +28,6 @@ @given(DATETIME_JAN_1_1900_OPTIONAL_TZ, YQM_OFFSET) def test_on_offset_implementations(dt, offset): assume(not offset.normalize) - # This case is flaky in CI 2024-11-04 - assume( - not ( - WASM - and isinstance(dt.tzinfo, zoneinfo.ZoneInfo) - and dt.tzinfo.key == "Indian/Cocos" - and isinstance(offset, pd.offsets.MonthBegin) - ) - ) # check that the class-specific implementations of is_on_offset match # the general case definition: # (dt + offset) - offset == dt From 6698cd5de18a9a4cf03dc1ae86ffe8a10461eee5 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:34:27 -0800 Subject: [PATCH 5/7] Try installing tzdata to fix --- .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 212ce7441dfab..4652628919e9b 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -452,7 +452,7 @@ jobs: PANDAS_CI: 1 run: | source .venv-pyodide/bin/activate - pip install pytest hypothesis + pip install pytest hypothesis tzdata # 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 ec0ae7cf24abe7203575f6892e2ecaf5e9868d7f Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:52:28 -0800 Subject: [PATCH 6/7] Revert "Try installing tzdata to fix" This reverts commit 6698cd5de18a9a4cf03dc1ae86ffe8a10461eee5. --- .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 4652628919e9b..212ce7441dfab 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -452,7 +452,7 @@ jobs: PANDAS_CI: 1 run: | source .venv-pyodide/bin/activate - pip install pytest hypothesis tzdata + 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 1ff7895c896ddecb1e163e7b06b491523231903f Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:52:30 -0800 Subject: [PATCH 7/7] Revert "Undo original change" This reverts commit 5bc727258e669050cb0b30e2d652fbd85e86e8da. --- .../tseries/offsets/test_offsets_properties.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandas/tests/tseries/offsets/test_offsets_properties.py b/pandas/tests/tseries/offsets/test_offsets_properties.py index 943434e515828..809d8f87b2c02 100644 --- a/pandas/tests/tseries/offsets/test_offsets_properties.py +++ b/pandas/tests/tseries/offsets/test_offsets_properties.py @@ -8,12 +8,16 @@ tests, or when trying to pin down the bugs exposed by the tests below. """ +import zoneinfo + from hypothesis import ( assume, given, ) import pytest +from pandas.compat import WASM + import pandas as pd from pandas._testing._hypothesis import ( DATETIME_JAN_1_1900_OPTIONAL_TZ, @@ -28,6 +32,15 @@ @given(DATETIME_JAN_1_1900_OPTIONAL_TZ, YQM_OFFSET) def test_on_offset_implementations(dt, offset): assume(not offset.normalize) + # This case is flaky in CI 2024-11-04 + assume( + not ( + WASM + and isinstance(dt.tzinfo, zoneinfo.ZoneInfo) + and dt.tzinfo.key == "Indian/Cocos" + and isinstance(offset, pd.offsets.MonthBegin) + ) + ) # check that the class-specific implementations of is_on_offset match # the general case definition: # (dt + offset) - offset == dt