1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
Description: Allow tests to fail if multiprocessing is not available
This is currently the case on hurd-i386
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no
--- a/statsmodels/graphics/tests/test_functional.py
+++ b/statsmodels/graphics/tests/test_functional.py
@@ -15,6 +15,12 @@ try:
import matplotlib.pyplot as plt
except ImportError:
pass
+has_multiprocessing = True
+try:
+ import multiprocessing
+ multiprocessing.Pool()
+except ImportError:
+ has_multiprocessing = False
data = elnino.load()
@@ -64,6 +70,10 @@ def test_hdr_basic(close_figures):
outliers = labels[labels_pos]
assert_equal([1982, 1983, 1997, 1998], outliers)
assert_equal(labels[hdr.outliers_idx], outliers)
+ except ImportError:
+ if not has_multiprocessing:
+ pytest.xfail('Multiprocess not available')
+ raise
except OSError:
pytest.xfail('Multiprocess randomly crashes in Windows testing')
@@ -78,6 +88,10 @@ def test_hdr_basic_brute(close_figures,
21.231, 20.366, 20.168, 20.434, 21.111, 22.299]
assert_almost_equal(hdr.median, median_t, decimal=2)
+ except ImportError:
+ if not has_multiprocessing:
+ pytest.xfail('Multiprocess not available')
+ raise
except OSError:
pytest.xfail('Multiprocess randomly crashes in Windows testing')
@@ -101,6 +115,10 @@ def test_hdr_plot(close_figures):
ax.set_xticks(np.arange(13, step=3) - 1)
ax.set_xticklabels(["", "Mar", "Jun", "Sep", "Dec"])
ax.set_xlim([-0.2, 11.2])
+ except ImportError:
+ if not has_multiprocessing:
+ pytest.xfail('Multiprocess not available')
+ raise
except OSError:
pytest.xfail('Multiprocess randomly crashes in Windows testing')
@@ -120,6 +138,10 @@ def test_hdr_alpha(close_figures):
[23.4, 24.8, 25.0, 23.9, 22.4, 21.1,
20.0, 19.3, 19.2, 19.4, 20.1, 21.3]])
assert_almost_equal(hdr.extra_quantiles, extra_quant_t, decimal=0)
+ except ImportError:
+ if not has_multiprocessing:
+ pytest.xfail('Multiprocess not available')
+ raise
except OSError:
pytest.xfail('Multiprocess randomly crashes in Windows testing')
@@ -148,6 +170,10 @@ def test_hdr_multiple_alpha(close_figure
19.697, 19.951, 20.622, 21.858]]
assert_almost_equal(hdr.extra_quantiles, np.vstack(extra_quant_t),
decimal=0)
+ except ImportError:
+ if not has_multiprocessing:
+ pytest.xfail('Multiprocess not available')
+ raise
except OSError:
pytest.xfail('Multiprocess randomly crashes in Windows testing')
@@ -166,6 +192,10 @@ def test_hdr_threshold(close_figures):
axis=1)
outliers = labels[labels_pos]
assert_equal([1968, 1982, 1983, 1997, 1998], outliers)
+ except ImportError:
+ if not has_multiprocessing:
+ pytest.xfail('Multiprocess not available')
+ raise
except OSError:
pytest.xfail('Multiprocess randomly crashes in Windows testing')
@@ -183,6 +213,10 @@ def test_hdr_bw(close_figures):
21.31, 20.44, 20.24, 20.51, 21.19, 22.38]
assert_almost_equal(hdr.median, median_t, decimal=2)
+ except ImportError:
+ if not has_multiprocessing:
+ pytest.xfail('Multiprocess not available')
+ raise
except OSError:
pytest.xfail('Multiprocess randomly crashes in Windows testing')
@@ -199,6 +233,10 @@ def test_hdr_ncomp(close_figures):
median_t = [24.33, 25.71, 26.04, 25.08, 23.74, 22.40,
21.32, 20.45, 20.25, 20.53, 21.20, 22.39]
assert_almost_equal(hdr.median, median_t, decimal=2)
+ except ImportError:
+ if not has_multiprocessing:
+ pytest.xfail('Multiprocess not available')
+ raise
except OSError:
pytest.xfail('Multiprocess randomly crashes in Windows testing')
|