Skip to content

Commit 45ae244

Browse files
Skip numerically unstable tests instead of marking them as XFAIL
This way they don't XPASS sometimes. Also it doesn't waste compute resources on tests whoose outcome has no relevance.
1 parent c4aca95 commit 45ae244

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

pymc3/tests/test_distributions.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ def test_chisquared_logp(self):
10561056
lambda value, nu: sp.chi2.logpdf(value, df=nu),
10571057
)
10581058

1059-
@pytest.mark.xfail(
1059+
@pytest.mark.skipif(
10601060
condition=(aesara.config.floatX == "float32"),
10611061
reason="Fails on float32 due to numerical issues",
10621062
)
@@ -1423,7 +1423,7 @@ def test_fun(value, mu, sigma):
14231423
test_fun,
14241424
)
14251425

1426-
@pytest.mark.xfail(
1426+
@pytest.mark.skipif(
14271427
condition=(aesara.config.floatX == "float32"),
14281428
reason="Fails on float32 due to numerical issues",
14291429
)
@@ -1449,7 +1449,7 @@ def test_inverse_gamma_logp(self):
14491449
# pymc-devs/aesara#224: skip_paramdomain_outside_edge_test has to be set
14501450
# True to avoid triggering a C-level assertion in the Aesara GammaQ function
14511451

1452-
@pytest.mark.xfail(
1452+
@pytest.mark.skipif(
14531453
condition=(aesara.config.floatX == "float32"),
14541454
reason="Fails on float32 due to numerical issues",
14551455
)
@@ -1465,7 +1465,7 @@ def test_inverse_gamma_logcdf(self):
14651465
skip_paramdomain_outside_edge_test=True,
14661466
)
14671467

1468-
@pytest.mark.xfail(
1468+
@pytest.mark.skipif(
14691469
condition=(aesara.config.floatX == "float32"),
14701470
reason="Fails on float32 due to scaling issues",
14711471
)
@@ -1496,7 +1496,7 @@ def test_pareto(self):
14961496
lambda value, alpha, m: sp.pareto.logcdf(value, alpha, scale=m),
14971497
)
14981498

1499-
@pytest.mark.xfail(
1499+
@pytest.mark.skipif(
15001500
condition=(aesara.config.floatX == "float32"),
15011501
reason="Fails on float32 due to numerical issues",
15021502
)
@@ -1508,7 +1508,7 @@ def test_weibull_logp(self):
15081508
lambda value, alpha, beta: sp.exponweib.logpdf(value, 1, alpha, scale=beta),
15091509
)
15101510

1511-
@pytest.mark.xfail(
1511+
@pytest.mark.skipif(
15121512
condition=(aesara.config.floatX == "float32"),
15131513
reason="Fails on float32 due to inf issues",
15141514
)
@@ -1560,7 +1560,7 @@ def test_binomial(self):
15601560
)
15611561

15621562
@pytest.mark.xfail(reason="checkd tests has not been refactored")
1563-
@pytest.mark.xfail(condition=(aesara.config.floatX == "float32"), reason="Fails on float32")
1563+
@pytest.mark.skipif(condition=(aesara.config.floatX == "float32"), reason="Fails on float32")
15641564
def test_beta_binomial_distribution(self):
15651565
self.checkd(
15661566
BetaBinomial,
@@ -1681,7 +1681,7 @@ def test_constantdist(self):
16811681
self.check_logp(Constant, I, {"c": I}, lambda value, c: np.log(c == value))
16821682

16831683
@pytest.mark.xfail(reason="Test has not been refactored")
1684-
@pytest.mark.xfail(
1684+
@pytest.mark.skipif(
16851685
condition=(aesara.config.floatX == "float32"),
16861686
reason="Fails on float32 due to inf issues",
16871687
)
@@ -1723,7 +1723,7 @@ def logcdf_fn(value, psi, theta):
17231723
)
17241724

17251725
@pytest.mark.xfail(reason="Test not refactored yet")
1726-
@pytest.mark.xfail(
1726+
@pytest.mark.skipif(
17271727
condition=(aesara.config.floatX == "float32"),
17281728
reason="Fails on float32 due to inf issues",
17291729
)
@@ -1860,7 +1860,7 @@ def test_mvnormal(self, n):
18601860
extra_args={"lower": False},
18611861
)
18621862

1863-
@pytest.mark.xfail(
1863+
@pytest.mark.skipif(
18641864
condition=(aesara.config.floatX == "float32"),
18651865
reason="Fails on float32 due to inf issues",
18661866
)
@@ -2521,7 +2521,7 @@ def test_ex_gaussian_cdf_outside_edges(self):
25212521
skip_paramdomain_inside_edge_test=True, # Valid values are tested above
25222522
)
25232523

2524-
@pytest.mark.xfail(condition=(aesara.config.floatX == "float32"), reason="Fails on float32")
2524+
@pytest.mark.skipif(condition=(aesara.config.floatX == "float32"), reason="Fails on float32")
25252525
def test_vonmises(self):
25262526
self.check_logp(
25272527
VonMises,
@@ -2571,7 +2571,7 @@ def test_logitnormal(self):
25712571
decimal=select_by_precision(float64=6, float32=1),
25722572
)
25732573

2574-
@pytest.mark.xfail(
2574+
@pytest.mark.skipif(
25752575
condition=(aesara.config.floatX == "float32"),
25762576
reason="Some combinations underflow to -inf in float32 in pymc version",
25772577
)
@@ -2603,7 +2603,7 @@ def test_moyal_logp(self):
26032603
lambda value, mu, sigma: floatX(sp.moyal.logpdf(value, mu, sigma)),
26042604
)
26052605

2606-
@pytest.mark.xfail(
2606+
@pytest.mark.skipif(
26072607
condition=(aesara.config.floatX == "float32"),
26082608
reason="Pymc3 underflows earlier than scipy on float32",
26092609
)
@@ -2617,7 +2617,7 @@ def test_moyal_logcdf(self):
26172617
if aesara.config.floatX == "float32":
26182618
raise Exception("Flaky test: It passed this time, but XPASS is not allowed.")
26192619

2620-
@pytest.mark.xfail(condition=(aesara.config.floatX == "float32"), reason="Fails on float32")
2620+
@pytest.mark.skipif(condition=(aesara.config.floatX == "float32"), reason="Fails on float32")
26212621
def test_interpolated(self):
26222622
for mu in R.vals:
26232623
for sigma in Rplus.vals:

0 commit comments

Comments
 (0)