From: Debian Science Maintainers Date: Sun, 1 Sep 2024 10:18:24 +0000 (+0100) Subject: Don't require a warning armel numpy doesn't have X-Git-Tag: archive/raspbian/0.14.2+dfsg-2+rpi1^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9caa2f962787526f3e5624c99c0b95dcb2d42c43;p=statsmodels.git Don't require a warning armel numpy doesn't have Author: Rebecca N. Palmer Forwarded: no (this version requires dpkg) Gbp-Pq: Name ignore_armel_nonwarning.patch --- diff --git a/statsmodels/stats/tests/test_rates_poisson.py b/statsmodels/stats/tests/test_rates_poisson.py index 28baefb..5002231 100644 --- a/statsmodels/stats/tests/test_rates_poisson.py +++ b/statsmodels/stats/tests/test_rates_poisson.py @@ -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 import statsmodels.stats.rates as smr @@ -716,7 +722,7 @@ class TestMethodsCompare2indep(): assert_allclose(tst2.pvalue, tst.pvalue, rtol=rtol) # check corner case count2 = 0, see issue #8313 - with pytest.warns(RuntimeWarning): + with (contextlib.nullcontext() if debian_arch=='armel' else pytest.warns(RuntimeWarning)): tst = smr.test_poisson_2indep(count1, n1, 0, n2, method=meth, compare=compare, value=None, alternative='two-sided')