Ignore extra warnings that may occur on mips*
authorDebian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org>
Thu, 18 Dec 2025 07:37:30 +0000 (07:37 +0000)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Thu, 18 Dec 2025 07:37:30 +0000 (07:37 +0000)
Some mips* hardware seems to emit
RuntimeWarning: invalid value encountered in multiply
on multiplication by explicit np.nan, which breaks these tests.

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no

Gbp-Pq: Name mips_ignore_nan_warnings.patch

statsmodels/discrete/tests/test_discrete.py
statsmodels/regression/tests/test_regression.py
statsmodels/tsa/holtwinters/tests/test_holtwinters.py

index 00eb92de276a2feed091bb4453f9d9a8ce5399b1..40bb4999c819f6fb3091e265ed4d9646022f8396 100644 (file)
@@ -27,6 +27,7 @@ import pandas as pd
 import pytest
 from scipy import stats
 from scipy.stats import nbinom
+import platform
 
 import statsmodels.api as sm
 from statsmodels.discrete.discrete_margins import _iscount, _isdummy
@@ -2540,7 +2541,8 @@ def test_optim_kwds_prelim():
 def test_unchanging_degrees_of_freedom():
     data = load_randhie()
     # see GH3734
-    warnings.simplefilter('error')
+    if 'mips' not in platform.uname()[4]:
+        warnings.simplefilter('error')
     model = sm.NegativeBinomial(data.endog, data.exog, loglike_method='nb2')
     params = np.array([-0.05654134, -0.21213734,  0.08783102, -0.02991825,
                        0.22902315,  0.06210253,  0.06799444,  0.08406794,
index 8d6a16022def3bfc8011f4a55541ab9cff617185..d1cb42a537fafab25cf40d40afbcb5672191f0d9 100644 (file)
@@ -6,6 +6,7 @@ from statsmodels.compat.scipy import SP_LT_116
 from statsmodels.compat.python import lrange
 
 import warnings
+import platform
 
 import numpy as np
 from numpy.testing import (
@@ -1610,7 +1611,8 @@ def test_ols_constant(reset_randomstate):
     with warnings.catch_warnings(record=True) as recording:
         assert np.isnan(res.fvalue)
         assert np.isnan(res.f_pvalue)
-    assert len(recording) == 0
+    if 'mips' not in platform.uname()[4]:
+        assert len(recording) == 0
 
 
 def test_summary_no_constant():
index 71a7def7e2f80674abd274bac9acb13c88886adc..672d60dc56242742d50c07aaeaed9c13113600a6 100644 (file)
@@ -19,6 +19,8 @@ from numpy.testing import assert_allclose, assert_almost_equal
 import pandas as pd
 import pytest
 import scipy.stats
+import contextlib
+import platform
 
 from statsmodels.tools.sm_exceptions import ValueWarning
 from statsmodels.tsa.holtwinters import (
@@ -822,8 +824,9 @@ def test_infer_freq():
         mod = ExponentialSmoothing(
             hd2, trend="add", seasonal="add", initialization_method="estimated"
         )
-        assert len(w) == 1
-        assert "ValueWarning" in str(w[0])
+        if 'mips' not in platform.uname()[4]:
+            assert len(w) == 1
+        assert "ValueWarning" in str(w[0])+str(w[-1])
     assert mod.seasonal_periods == 12
 
 
@@ -1976,7 +1979,7 @@ def test_forecast_index_types(ses, index_typ):
     ses = ses.copy()
     ses.index = index[:-36]
 
-    with pytest_warns(warning):
+    with (contextlib.nullcontext() if (warning is None and 'mips' in platform.uname()[4]) else pytest_warns(warning)):
         res = ExponentialSmoothing(
             ses,
             trend="add",
@@ -1984,7 +1987,7 @@ def test_forecast_index_types(ses, index_typ):
             initialization_method="heuristic",
             **kwargs
         ).fit()
-    with pytest_warns(warning):
+    with (contextlib.nullcontext() if (warning is None and 'mips' in platform.uname()[4]) else pytest_warns(warning)):
         fcast = res.forecast(36)
     assert isinstance(fcast, pd.Series)
     pd.testing.assert_index_equal(fcast.index, fcast_index)