From c4586cab0918831e5a69c2be53fdf01008a43992 Mon Sep 17 00:00:00 2001 From: Stefan Jansen Date: Thu, 8 Oct 2026 16:56:08 -0400 Subject: [PATCH] test: ignore exchange_calendars' pandas 3.1 tz-values deprecation pandas 3.1 deprecates Series.values dropping timezone information. exchange_calendars' ExchangeCalendar.__init__ (exchange_calendar.py:403) still does this, and with filterwarnings = error every test that builds a calendar fails on the Python 3.15 prerelease jobs, which install pandas 3.1.0rc0. pandas attributes the warning to pandas.core.series, so the filter is scoped by its exact message instead of the calling module. Under pandas 3.1.0rc0 all 20 occurrences in the suite come from that one exchange_calendars line. The warning-filter cap moves from five to six to admit it. Remove the filter once an exchange_calendars release stops calling Series.values on tz-aware series. Co-Authored-By: Claude Opus 5.5 --- pyproject.toml | 3 +++ tests/contracts/test_quality_gates.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1645db85..68bd00f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -191,6 +191,9 @@ filterwarnings = [ "ignore:co_lnotab is deprecated, use co_lines instead.*:DeprecationWarning:zipline.*", "ignore::UserWarning:vectorbt", # VectorBT accessor registration warnings "ignore::FutureWarning:zipline", # Zipline compatibility warnings + # pandas 3.1 Pandas4Warning from exchange_calendars' calendar constructor; pandas attributes + # it to its own module, so the message is what keeps the filter narrow + "ignore:Series.values returning an ndarray that drops timezone:DeprecationWarning:pandas.core.series", ] [tool.ruff] diff --git a/tests/contracts/test_quality_gates.py b/tests/contracts/test_quality_gates.py index 6e89e5dd..1b2ddd23 100644 --- a/tests/contracts/test_quality_gates.py +++ b/tests/contracts/test_quality_gates.py @@ -79,7 +79,7 @@ def test_warning_policy_fails_new_warnings_and_has_no_global_suppression() -> No assert filters[0] == "error" assert "ignore::DeprecationWarning" not in filters assert "ignore::PendingDeprecationWarning" not in filters - assert len(filters) <= 5 + assert len(filters) <= 6 def test_accounting_tolerance_is_an_exact_ulp_bound() -> None: