scHPF icon indicating copy to clipboard operation
scHPF copied to clipboard

Failing pytest at installation

Open reetm09 opened this issue 1 year ago • 2 comments

Hi,

I followed the instructions on the ReadMe for installation, outlined here as well.

git clone https://github.com/simslab/scHPF.git
cd scHPF
pip install .
conda install pytest

However when checking pytest I am failing the tests/test_preprocessing.py:

❯ pytest
====================================== test session starts =======================================
platform darwin -- Python 3.12.5, pytest-7.4.4, pluggy-1.5.0
rootdir: /Users/reetmishra/.local/share/scHPF
configfile: setup.cfg
plugins: jaxtyping-0.2.36
collected 74 items                                                                               

tests/test_inference.py ............................................                       [ 59%]
tests/test_misc.py .                                                                       [ 60%]
tests/test_preprocessing.py ..F....                                                        [ 70%]
tests/test_scHPF_model.py ................                                                 [ 91%]
tests/test_util.py ......                                                                  [100%]

============================================ FAILURES ============================================
_________________________________________ test_load_like _________________________________________

tmp_path = PosixPath('/private/var/folders/p0/rwks1n59023cnb9ck2xdkc180000gn/T/pytest-of-reetmishra/pytest-0/test_load_like0')

    def test_load_like(tmp_path):
        gene_file = str(tmp_path / 'genes.txt')
    
        # make a permutation
        perm = np.random.choice(NGENES, NGENES-10, replace=False)
    
        # load data to make reference and permute
        umis, genes = prep.load_txt(TXT)
>       umis = umis.A[:, perm]
E       AttributeError: 'coo_matrix' object has no attribute 'A'

tests/test_preprocessing.py:60: AttributeError
======================================== warnings summary ========================================
tests/test_preprocessing.py::test_genelist_mask
tests/test_preprocessing.py::test_load_and_filter
  /Users/reetmishra/.local/share/scHPF/tests/test_preprocessing.py:29: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
    return pd.read_csv(PROTEIN_CODING, delim_whitespace=True, header=None)

tests/test_preprocessing.py::test_genelist_mask
  /Users/reetmishra/.local/share/scHPF/tests/test_preprocessing.py:39: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
    return pd.read_csv(TXT, delim_whitespace=True, header=None)[[0,1]]

tests/test_preprocessing.py::test_load_and_filter
  /Users/reetmishra/.local/share/scHPF/tests/test_preprocessing.py:34: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
    return pd.read_csv(BLIST, delim_whitespace=True, header=None)

tests/test_preprocessing.py::test_load_and_filter
tests/test_preprocessing.py::test_load_and_filter
  /Users/reetmishra/.local/share/scHPF/schpf/preprocessing.py:402: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
    whitelist = pd.read_csv(whitelist, delim_whitespace=True, header=None)

tests/test_preprocessing.py::test_load_and_filter
tests/test_preprocessing.py::test_load_and_filter
  /Users/reetmishra/.local/share/scHPF/schpf/preprocessing.py:404: DeprecationWarning: Bitwise inversion '~' on bool is deprecated. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
    split_on_dot = ~no_split_on_dot)

tests/test_preprocessing.py::test_load_and_filter
tests/test_preprocessing.py::test_load_and_filter
  /Users/reetmishra/.local/share/scHPF/schpf/preprocessing.py:406: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead
    blacklist = pd.read_csv(blacklist, delim_whitespace=True, header=None)

tests/test_preprocessing.py::test_load_and_filter
tests/test_preprocessing.py::test_load_and_filter
  /Users/reetmishra/.local/share/scHPF/schpf/preprocessing.py:408: DeprecationWarning: Bitwise inversion '~' on bool is deprecated. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
    whitelist=False, split_on_dot = ~no_split_on_dot)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================== short test summary info =====================================
FAILED tests/test_preprocessing.py::test_load_like - AttributeError: 'coo_matrix' object has no attribute 'A'
=========================== 1 failed, 73 passed, 12 warnings in 4.93s ============================

I would appreciate any help in resolving these!

Thanks so much!

reetm09 avatar Dec 29 '24 19:12 reetm09