I stumbled over an issue that the tests running by py.test, would not be able to import modules - I am actually not sure why.
After removing the __init__.py from the tests directory, all modules could be imported without any issues.
I just wanted to report it, if anyone else runs into the same issue.
py.test ./tests
python 3.8
MacOS 15.5.5
before removing:
============================================================================================================================ ERRORS =============================================================================================================================
_________________________________________________________________________________________________________ ERROR collecting tests/test_data_handling.py __________________________________________________________________________________________________________
ImportError while importing test module '/Users/alka/Documents/work/software/pyprophet_test/pyprophet/tests/test_data_handling.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_data_handling.py:4: in <module>
from pyprophet.data_handling import check_for_unique_blocks
pyprophet/data_handling.py:9: in <module>
from .optimized import find_top_ranked, rank
pyprophet/optimized.py:1: in <module>
from ._optimized import *
E ModuleNotFoundError: No module named 'pyprophet._optimized'
______________________________________________________________________________________________________________ ERROR collecting tests/test_ipf.py _______________________________________________________________________________________________________________
ImportError while importing test module '/Users/alka/Documents/work/software/pyprophet_test/pyprophet/tests/test_ipf.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_ipf.py:4: in <module>
from pyprophet.ipf import prepare_precursor_bm, prepare_transition_bm, apply_bm, compute_model_fdr
pyprophet/ipf.py:9: in <module>
from .data_handling import check_sqlite_table
pyprophet/data_handling.py:9: in <module>
from .optimized import find_top_ranked, rank
pyprophet/optimized.py:1: in <module>
from ._optimized import *
E ModuleNotFoundError: No module named 'pyprophet._optimized'
___________________________________________________________________________________________________________ ERROR collecting tests/test_optimized.py ____________________________________________________________________________________________________________
ImportError while importing test module '/Users/alka/Documents/work/software/pyprophet_test/pyprophet/tests/test_optimized.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_optimized.py:2: in <module>
import pyprophet.optimized as o
pyprophet/optimized.py:1: in <module>
from ._optimized import *
E ModuleNotFoundError: No module named 'pyprophet._optimized'
_________________________________________________________________________________________________________ ERROR collecting tests/test_pyprophet_ipf.py __________________________________________________________________________________________________________
ImportError while importing test module '/Users/alka/Documents/work/software/pyprophet_test/pyprophet/tests/test_pyprophet_ipf.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_pyprophet_ipf.py:13: in <module>
from pyprophet.ipf import read_pyp_peakgroup_precursor
pyprophet/ipf.py:9: in <module>
from .data_handling import check_sqlite_table
pyprophet/data_handling.py:9: in <module>
from .optimized import find_top_ranked, rank
pyprophet/optimized.py:1: in <module>
from ._optimized import *
E ModuleNotFoundError: No module named 'pyprophet._optimized'
________________________________________________________________________________________________________ ERROR collecting tests/test_pyprophet_score.py _________________________________________________________________________________________________________
ImportError while importing test module '/Users/alka/Documents/work/software/pyprophet_test/pyprophet/tests/test_pyprophet_score.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_pyprophet_score.py:13: in <module>
from pyprophet.ipf import read_pyp_peakgroup_precursor
pyprophet/ipf.py:9: in <module>
from .data_handling import check_sqlite_table
pyprophet/data_handling.py:9: in <module>
from .optimized import find_top_ranked, rank
pyprophet/optimized.py:1: in <module>
from ._optimized import *
E ModuleNotFoundError: No module named 'pyprophet._optimized'
_____________________________________________________________________________________________________________ ERROR collecting tests/test_stats.py ______________________________________________________________________________________________________________
ImportError while importing test module '/Users/alka/Documents/work/software/pyprophet_test/pyprophet/tests/test_stats.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
tests/test_stats.py:4: in <module>
from pyprophet.stats import to_one_dim_array, pnorm, pemp, pi0est, qvalue, bw_nrd0, lfdr, stat_metrics
pyprophet/stats.py:12: in <module>
from .optimized import (find_nearest_matches as _find_nearest_matches,
pyprophet/optimized.py:1: in <module>
from ._optimized import *
E ModuleNotFoundError: No module named 'pyprophet._optimized'
==================================================================================================================== short test summary info ====================================================================================================================
ERROR tests/test_data_handling.py
ERROR tests/test_ipf.py
ERROR tests/test_optimized.py
ERROR tests/test_pyprophet_ipf.py
ERROR tests/test_pyprophet_score.py
ERROR tests/test_stats.py
I stumbled over an issue that the tests running by py.test, would not be able to import modules - I am actually not sure why. After removing the
__init__.py
from the tests directory, all modules could be imported without any issues.I just wanted to report it, if anyone else runs into the same issue.
py.test ./tests
python 3.8 MacOS 15.5.5
before removing:
after removing: