From 7e7e98029e7479e21ab9f9ec06af65e4b5bae3ad Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Fri, 29 Oct 2021 23:55:41 +0200 Subject: [PATCH 1/3] TST: silence test failures on macOS for `beta.ppf` overflow See gh-14901 for details. [skip azp] [skip github] --- scipy/stats/tests/test_distributions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py index b62aa5ef3fe8..e97567fb6631 100644 --- a/scipy/stats/tests/test_distributions.py +++ b/scipy/stats/tests/test_distributions.py @@ -37,6 +37,10 @@ # python -OO strips docstrings DOCSTRINGS_STRIPPED = sys.flags.optimize > 1 +# Failing on macOS 11, Intel CPUs. See gh-14901 +MACOS_INTEL = (sys.platform == 'darwin') and (platform.machine() == 'x86_64') + + # distributions to skip while testing the fix for the support method # introduced in gh-13294. These distributions are skipped as they # always return a non-nan support for every parametrization. @@ -2851,6 +2855,7 @@ def test_issue_12635(self): p, a, b = 0.9999999999997369, 75.0, 66334470.0 assert_allclose(stats.beta.ppf(p, a, b), 2.343620802982393e-06) + @pytest.mark.skipif(MACOS_INTEL, reason="Overflow, see gh-14901") def test_issue_12794(self): # Confirm that Boost's beta distribution resolves gh-12794. # Check against R. @@ -2868,6 +2873,7 @@ def test_issue_12794(self): res = stats.beta.sf(inv, count_list + 1, 100000 - count_list) assert_allclose(res, p) + @pytest.mark.skipif(MACOS_INTEL, reason="Overflow, see gh-14901") def test_issue_12796(self): # Confirm that Boost's beta distribution succeeds in the case # of gh-12796 @@ -2879,6 +2885,7 @@ def test_issue_12796(self): res = stats.beta.cdf(inv, a, b) assert_allclose(res, 1 - alpha_2) + @pytest.mark.skipif(MACOS_INTEL, reason="Overflow, see gh-14901") def test_endpoints(self): # Confirm that boost's beta distribution returns inf at x=1 # when b<1 From c0e06dc0a1bef426992825f28ae9bafd1c5b52f1 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Fri, 29 Oct 2021 17:00:04 -0600 Subject: [PATCH 2/3] MAINT: PR 14938 revisions * add missing `platform` import --- scipy/stats/tests/test_distributions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py index e97567fb6631..90eb4eaa9a0b 100644 --- a/scipy/stats/tests/test_distributions.py +++ b/scipy/stats/tests/test_distributions.py @@ -7,6 +7,7 @@ import pickle import os import json +import platform from numpy.testing import (assert_equal, assert_array_equal, assert_almost_equal, assert_array_almost_equal, From cf7c2b3c92447bf6d4f00c3b1b33ba7f9cbbc478 Mon Sep 17 00:00:00 2001 From: Tyler Reddy Date: Fri, 29 Oct 2021 17:24:08 -0600 Subject: [PATCH 3/3] MAINT: PR 14938 revisions * fix up the third skipped test to match what CI is complaining about --- scipy/stats/tests/test_distributions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scipy/stats/tests/test_distributions.py b/scipy/stats/tests/test_distributions.py index 90eb4eaa9a0b..2bf6ecfb6870 100644 --- a/scipy/stats/tests/test_distributions.py +++ b/scipy/stats/tests/test_distributions.py @@ -2845,6 +2845,7 @@ def test_fit_duplicated_fixed_parameter(self): x = [0.1, 0.5, 0.6] assert_raises(ValueError, stats.beta.fit, x, fa=0.5, fix_a=0.5) + @pytest.mark.skipif(MACOS_INTEL, reason="Overflow, see gh-14901") def test_issue_12635(self): # Confirm that Boost's beta distribution resolves gh-12635. # Check against R: @@ -2886,7 +2887,6 @@ def test_issue_12796(self): res = stats.beta.cdf(inv, a, b) assert_allclose(res, 1 - alpha_2) - @pytest.mark.skipif(MACOS_INTEL, reason="Overflow, see gh-14901") def test_endpoints(self): # Confirm that boost's beta distribution returns inf at x=1 # when b<1