This is an automated email from the ASF dual-hosted git repository.

skrawcz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hamilton.git


The following commit(s) were added to refs/heads/main by this push:
     new ac349407 Fix failing unit tests for pandas and mlflow compatibility  
(#1463)
ac349407 is described below

commit ac3494073614349b95a800a93393aa1a591b2014
Author: Pablo Eduardo Diaz <[email protected]>
AuthorDate: Thu Feb 5 03:27:10 2026 -0400

    Fix failing unit tests for pandas and mlflow compatibility  (#1463)
    
    * Fix unit tests for external library changes
    
    - Update PeriodIndex API to use from_fields() for pandas 2.2+ compatibility
    - Add pytest.importorskip for mlflow tests on Python 3.14+
    
    Fixes #1450
---
 tests/plugins/test_mlflow_extension.py | 5 ++++-
 tests/test_base.py                     | 8 +++++---
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tests/plugins/test_mlflow_extension.py 
b/tests/plugins/test_mlflow_extension.py
index d98d3ed4..d365809e 100644
--- a/tests/plugins/test_mlflow_extension.py
+++ b/tests/plugins/test_mlflow_extension.py
@@ -17,9 +17,12 @@
 
 from pathlib import Path
 
-import mlflow
 import numpy as np
 import pytest
+
+# Skip entire module if mlflow is not available (e.g., Python 3.14+)
+mlflow = pytest.importorskip("mlflow")
+
 from sklearn.base import BaseEstimator
 from sklearn.linear_model import LinearRegression
 
diff --git a/tests/test_base.py b/tests/test_base.py
index 663892d4..109d0507 100644
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -481,17 +481,19 @@ def 
test_StrictIndexTypePandasDataFrameResult_build_result(outputs, expected_res
                 ),
                 "series2": pd.Series(
                     [4, 5, 6],
-                    index=pd.PeriodIndex(year=[2022, 2022, 2022], month=[1, 2, 
3], freq="M"),
+                    index=pd.PeriodIndex.from_fields(
+                        year=[2022, 2022, 2022], month=[1, 2, 3], freq="M"
+                    ),
                 ),
                 "series3": pd.Series(
                     [4, 5, 6],
-                    index=pd.PeriodIndex(
+                    index=pd.PeriodIndex.from_fields(
                         year=[2022, 2022, 2022], month=[1, 1, 1], day=[3, 4, 
5], freq="B"
                     ),
                 ),
                 "series4": pd.Series(
                     [4, 5, 6],
-                    index=pd.PeriodIndex(
+                    index=pd.PeriodIndex.from_fields(
                         year=[2022, 2022, 2022], month=[1, 1, 1], day=[4, 11, 
18], freq="W"
                     ),
                 ),

Reply via email to