diff --git a/tests/test_matrix.py b/tests/test_matrix.py index dba083f6..72ef2671 100644 --- a/tests/test_matrix.py +++ b/tests/test_matrix.py @@ -56,6 +56,7 @@ def run_cov( assert cA.cols() == p +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("ps", [[1, 5, 8, 2]]) @pytest.mark.parametrize("n", [2, 100, 20]) @@ -73,6 +74,7 @@ def test_cov_block_diag(n, ps, dtype, seed=0): run_cov(A, cA, dtype) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("order", ["C", "F"]) @pytest.mark.parametrize("n, p", [ @@ -107,6 +109,7 @@ def test_cov_lazy_cov(n, p, dtype, order, seed=0): run_cov(A, cA, dtype) +@pytest.mark.filterwarnings("ignore: Converting to CSC format.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("order", ["C", "F"]) @pytest.mark.parametrize("n, p", [ @@ -127,9 +130,7 @@ def test_cov_sparse(n, p, dtype, order, seed=0): "C": scipy.sparse.csr_matrix, "F": scipy.sparse.csc_matrix, }[order](A) - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - cA = mod.sparse(A_sp, method="cov", n_threads=3) + cA = mod.sparse(A_sp, method="cov", n_threads=3) run_cov(A, cA, dtype) @@ -268,6 +269,7 @@ def run_naive( assert np.allclose(expected, out, atol=atol) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("ps", [[1, 7, 41, 13, 113]]) @pytest.mark.parametrize("n", [10, 20, 30]) @@ -286,6 +288,7 @@ def test_naive_cconcatenate(n, ps, dtype, n_threads=2, seed=0): run_naive(X, cX, dtype) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("ns", [[1, 7, 41, 13, 113]]) @pytest.mark.parametrize("p", [10, 20, 30]) @@ -304,6 +307,7 @@ def test_naive_rconcatenate(ns, p, dtype, n_threads=2, seed=0): run_naive(X, cX, dtype) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("order", ["C", "F"]) @pytest.mark.parametrize("n, p", [ @@ -319,6 +323,7 @@ def test_naive_dense(n, p, dtype, order, seed=0): run_naive(X, cX, dtype) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("order", ["C", "F"]) @pytest.mark.parametrize("n, d", [ @@ -377,6 +382,7 @@ def _create_dense(X, pairs, levels): ad.configs.set_configs("min_bytes", min_bytes) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("order", ["C", "F"]) @pytest.mark.parametrize("n, p, K", [ @@ -413,6 +419,7 @@ def test_naive_kronecker_eye_dense(n, p, K, dtype, order, seed=0): run_naive(X, cX, dtype) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("order", ["C", "F"]) @pytest.mark.parametrize("n, d", [ @@ -523,6 +530,7 @@ def create_dense(calldata, ancestries, A): ad.configs.set_configs("min_bytes", min_bytes) +@pytest.mark.filterwarnings("ignore: Converting to CSC format.") @pytest.mark.parametrize("dtype", [np.float32, np.float64]) @pytest.mark.parametrize("order", ["C", "F"]) @pytest.mark.parametrize("n, p", [ @@ -538,9 +546,7 @@ def test_naive_sparse(n, p, dtype, order, seed=0): "C": scipy.sparse.csr_matrix, "F": scipy.sparse.csc_matrix, }[order](X) - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - cX = mod.sparse(X_sp, method="naive", n_threads=3) + cX = mod.sparse(X_sp, method="naive", n_threads=3) run_naive(X, cX, dtype) diff --git a/tests/test_solver.py b/tests/test_solver.py index c3b1a482..1cad7784 100644 --- a/tests/test_solver.py +++ b/tests/test_solver.py @@ -469,6 +469,7 @@ def run_solve_gaussian(state, args, pin): return state +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("constraint", [False, True]) @pytest.mark.parametrize("n, p, G, S", [ [10, 4, 2, 2], @@ -521,6 +522,7 @@ def test_solve_gaussian_pin_naive( run_solve_gaussian(state, args, pin=True) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("constraint", [False, True]) @pytest.mark.parametrize("n, p, G, S", [ [10, 4, 2, 2], @@ -582,6 +584,7 @@ def test_solve_gaussian_pin_cov( run_solve_gaussian(state, args, pin=True) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("constraint", [False, True]) @pytest.mark.parametrize("n, p, G", [ [10, 4, 2], @@ -818,6 +821,7 @@ def test_solve_gaussian_snp_unphased( os.remove(filename) +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") @pytest.mark.parametrize("n, p", [ [10, 4], [10, 100], diff --git a/tests/test_state.py b/tests/test_state.py index e56e56de..ecb2c9c5 100644 --- a/tests/test_state.py +++ b/tests/test_state.py @@ -1,12 +1,13 @@ from adelie.logger import logger import logging logger.setLevel(logging.DEBUG) - import adelie.state as mod import adelie.matrix as matrix import numpy as np +import pytest +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") def test_state_gaussian_pin_naive(): n = 1000 p = 100 @@ -65,6 +66,7 @@ def test_state_gaussian_pin_naive(): assert state.iters == 0 +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") def test_state_gaussian_pin_cov(): n = 1000 p = 100 @@ -118,6 +120,7 @@ def test_state_gaussian_pin_cov(): assert state.iters == 0 +@pytest.mark.filterwarnings("ignore: Detected matrix to be C-contiguous.") def test_state_gaussian_naive(): n = 3 p = 100