diff --git a/python/tests/test_haplotype_matching.py b/python/tests/test_haplotype_matching.py index b09ebcc005..ee2999296b 100644 --- a/python/tests/test_haplotype_matching.py +++ b/python/tests/test_haplotype_matching.py @@ -22,7 +22,7 @@ """ Python implementation of the Li and Stephens forwards and backwards algorithms. """ -import itertools +import warnings import lshmm as ls import msprime @@ -874,13 +874,16 @@ def example_parameters_haplotypes(self, ts, seed=42): for s in haplotypes: yield n, H, s, r, mu - # Mixture of random and extremes - rs = [np.zeros(m) + 0.999, np.zeros(m) + 1e-6, np.random.rand(m)] - mus = [np.zeros(m) + 0.33, np.zeros(m) + 1e-6, np.random.rand(m) * 0.33] + # FIXME removing these as tests are abominably slow. + # We'll be refactoring all this to use pytest anyway, so let's not + # worry too much about coverage for now. + # # Mixture of random and extremes + # rs = [np.zeros(m) + 0.999, np.zeros(m) + 1e-6, np.random.rand(m)] + # mus = [np.zeros(m) + 0.33, np.zeros(m) + 1e-6, np.random.rand(m) * 0.33] - for s, r, mu in itertools.product(haplotypes, rs, mus): - r[0] = 0 - yield n, H, s, r, mu + # for s, r, mu in itertools.product(haplotypes, rs, mus): + # r[0] = 0 + # yield n, H, s, r, mu def assertAllClose(self, A, B): """Assert that all entries of two matrices are 'close'""" @@ -1029,13 +1032,18 @@ class TestForwardHapTree(FBAlgorithmBase): def verify(self, ts): for n, H, s, r, mu in self.example_parameters_haplotypes(ts): for scale_mutation in [False, True]: - F, c, ll = ls.forwards( - H, - s, - r, - mutation_rate=mu, - scale_mutation_based_on_n_alleles=scale_mutation, - ) + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + # Warning from lshmm: + # Passed a vector of mutation rates, but rescaling each mutation + # rate conditional on the number of alleles + F, c, ll = ls.forwards( + H, + s, + r, + mutation_rate=mu, + scale_mutation_based_on_n_alleles=scale_mutation, + ) # Note, need to remove the first sample from the ts, and ensure # that invariant sites aren't removed. ts_check = ts.simplify(range(1, n + 1), filter_sites=False)