Running the tests requires all optional dependencies to be available
Please make sure these conditions are met
- [x] I have checked that this issue has not already been reported.
- [x] I have confirmed this bug exists on the latest version of pertpy.
- [ ] (optional) I have confirmed this bug exists on the main branch.
Report
Trying to setup a local dev environment to tackle #771, I hit a missing module for a test:
git clone [email protected]:scverse/pertpy.git
cd pertpy
python -m venv .pertpy.venv
./.pertpy.venv/bin/activate
pip install -e ".[dev,test,doc]"
pytest
...
============================================================================================================ test session starts =============================================================================================================
platform linux -- Python 3.12.9, pytest-8.3.5, pluggy-1.6.0
rootdir: /home/planarian/mschilli/src/pertpy
configfile: pyproject.toml
testpaths: tests
plugins: fast-array-utils-1.2.1, jaxtyping-0.3.2
collected 217 items / 1 error / 1 skipped
=================================================================================================================== ERRORS ===================================================================================================================
_________________________________________________________________________________________ ERROR collecting tests/tools/_differential_gene_expression _________________________________________________________________________________________
tests/tools/_differential_gene_expression/conftest.py:6: in <module>
from pydeseq2.utils import load_example_data
E ModuleNotFoundError: No module named 'pydeseq2'
============================================================================================================== warnings summary ==============================================================================================================
.pertpy.venv/lib/python3.12/site-packages/jaxopt/__init__.py:59
<path>/pertpy/.pertpy.venv/lib/python3.12/site-packages/jaxopt/__init__.py:59: DeprecationWarning: JAXopt is no longer maintained. See https://docs.jax.dev/en/latest/ for alternatives.
warnings.warn(
.pertpy.venv/lib/python3.12/site-packages/_pytest/fixtures.py:1313
<path>/pertpy/.pertpy.venv/lib/python3.12/site-packages/_pytest/fixtures.py:1313: PytestRemovedIn9Warning: Marks applied to fixtures have no effect
See docs: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function
return fixture_marker(fixture_function)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================================================== short test summary info ===========================================================================================================
ERROR tests/tools/_differential_gene_expression - ModuleNotFoundError: No module named 'pydeseq2'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================ 1 skipped, 2 warnings, 1 error in 143.73s (0:02:23) =============================================================================================
I ~expect~ confirmed that using
pip install -e ".[dev,test,doc,de]"
~to fix~ fixes that issue but I'd expect pytest to only test features I built or contributing.md to tell me I need to build DE support for tests to work.
Maybe test can also made to depend on de?
I am not familiar with pyproject.toml, pip and pytest beyond basic usage.
Yup, to run all tests, you'd need the full DE setup. I haven't gotten to perfectly isolating the DE tests by only making them run if all modules are available.
You can see the full setup here: https://github.com/scverse/pertpy/blob/main/.github/workflows/test.yml
If you're willing to spend some time on solving this problem, I can guide you on how to go about it. Otherwise, I am afraid that for now, you'll need to either get the full set up to work or rely on the CI to give you feedback.
Sorry about that! I was recently primarily trying to improve the user experience and fixing this is/was pretty low on my list...
@Zethson: Thanks for the fast feedback, as always. I don't mind installing the DE dependencies. I just wanted to report the inconsistency between documentation and reality. 😉
Off-Topic: How long are the tests expected to run? I am at
======================= test session starts =======================
platform linux -- Python 3.12.9, pytest-8.3.5, pluggy-1.6.0
rootdir: /home/planarian/mschilli/src/pertpy
configfile: pyproject.toml
testpaths: tests
plugins: fast-array-utils-1.2.1, jaxtyping-0.3.2
collected 441 items / 2 skipped
tests/metadata/test_cell_line.py ..... [ 1%]
tests/metadata/test_compound.py .
tests/metadata/test_drug.py .
for about 1/2 hour now with no visible progress and no CPU activity as per htop.
I just wanted to run tests locally before hacking the codebase to ensure I am not breaking anything. 😅
They run for about 20 minutes on the CI. The metadata tests may download files and I fear that your download got stuck somewhere. You can try to restart it or disable the metadata tests.
pytest --ignore=path/to/folder
could work.
I tried three time and it always stopped at the same step.
Running pytest --ignore=tests/metadata/test_drug.py now. 🤞🏻
Thank you for the help.
PS: I am hitting several failing tests (so far nine in tests/tools/_differential_gene_expression/test_compare_groups.py and both in tests/tools/_differential_gene_expression/test_edger.py) but tests/tools/_coda/test_sccoda.py is running through so I'll just make sure I don't break this while working on #771 and maybe track down the other test failures in a separate issue when/if I find the time.
Just wanted to let you know that the out-of-the-box experience is not failure free.