Don't require a warning armel numpy doesn't have
authorDebian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org>
Sat, 5 Oct 2024 10:43:25 +0000 (11:43 +0100)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Sat, 5 Oct 2024 10:43:25 +0000 (11:43 +0100)
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no (this version requires dpkg)

Gbp-Pq: Name ignore_armel_nonwarning.patch

statsmodels/stats/tests/test_rates_poisson.py

index 5d2252fbfddcef58f55389d6b836a25af80ab879..dda02d898c35923278406920274265e9ec155a25 100644 (file)
@@ -4,6 +4,12 @@ import numpy as np
 from numpy import arange
 from numpy.testing import assert_allclose, assert_equal
 from scipy import stats
+# armel numpy currently doesn't have the divide-by-0 warning (see 0.14.0-1 build log and https://bugs.debian.org/956882)
+# using nullcontext() instead of warn=None to not start failing if this ever gets fixed
+import subprocess
+import contextlib
+debian_arch = subprocess.run(["dpkg","--print-architecture"],capture_output=True,encoding='utf-8').stdout.strip()
+
 
 # we cannot import test_poisson_2indep directly, pytest treats that as test
 from statsmodels.compat.python import PYTHON_IMPL_WASM
@@ -718,7 +724,7 @@ class TestMethodsCompare2indep():
 
         # check corner case count2 = 0, see issue #8313
         if not PYTHON_IMPL_WASM:  # No fp exception support in WASM
-            with pytest.warns(RuntimeWarning):
+            with (contextlib.nullcontext() if debian_arch=='armel' else pytest.warns(RuntimeWarning)):
                 smr.test_poisson_2indep(
                     count1, n1, 0, n2, method=meth,
                     compare=compare,