morphometrics / morphosamplers

A library for sampling image data along morphological objects such as splines and surfaces.
Other
6 stars 4 forks source link

[maint] tests under src/morphosamplers fail -- are out dated? not run on CI. #33

Closed psobolewskiPhD closed 4 months ago

psobolewskiPhD commented 4 months ago

Description

Cloned repo and tests fail when running pytest . Looking at CI, the tests that fail aren't being run. Looks like CI is just running tests under morphosamples/tests and not the ones in src/morphosamplers Running just pytest matches CI:

❯ pytest  
================================================================================================ test session starts ================================================================================================
platform darwin -- Python 3.10.14, pytest-8.2.0, pluggy-1.5.0
rootdir: /Users/sobolp/Documents/dev/morphosamplers
configfile: pyproject.toml
testpaths: tests
plugins: cov-5.0.0
collected 21 items                                                                                                                                                                                                  

tests/test_sampling.py ......                                                                                                                                                                                 [ 28%]
tests/test_spline_model.py ...............                                                                                                                                                                    [100%]

================================================================================================ 21 passed in 0.71s =================================================================================================

What I Did

Ran pytest . in repo.

❯ pytest .
================================================================================================ test session starts ================================================================================================
platform darwin -- Python 3.10.14, pytest-8.2.0, pluggy-1.5.0
rootdir: /Users/sobolp/Documents/dev/morphosamplers
configfile: pyproject.toml
plugins: cov-5.0.0
collected 21 items / 3 errors                                                                                                                                                                                       

====================================================================================================== ERRORS =======================================================================================================
________________________________________________________ ERROR collecting src/morphosamplers/samplers/path_samplers/tests/test_point_sampler_equidistant.py _________________________________________________________
ImportError while importing test module '/Users/sobolp/Documents/dev/morphosamplers/src/morphosamplers/samplers/path_samplers/tests/test_point_sampler_equidistant.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../micromamba/envs/morpho-dev/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/morphosamplers/samplers/path_samplers/tests/test_point_sampler_equidistant.py:4: in <module>
    from morphosamplers import PathSamplers
E   ImportError: cannot import name 'PathSamplers' from 'morphosamplers' (/Users/sobolp/Documents/dev/morphosamplers/src/morphosamplers/__init__.py)
__________________________________________________________ ERROR collecting src/morphosamplers/samplers/path_samplers/tests/test_pose_sampler_parallel.py ___________________________________________________________
ImportError while importing test module '/Users/sobolp/Documents/dev/morphosamplers/src/morphosamplers/samplers/path_samplers/tests/test_pose_sampler_parallel.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../micromamba/envs/morpho-dev/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/morphosamplers/samplers/path_samplers/tests/test_pose_sampler_parallel.py:5: in <module>
    from morphosamplers.samplers.path_samplers import PathSamplers
E   ImportError: cannot import name 'PathSamplers' from 'morphosamplers.samplers.path_samplers' (/Users/sobolp/Documents/dev/morphosamplers/src/morphosamplers/samplers/path_samplers/__init__.py)
_____________________________________________________________ ERROR collecting src/morphosamplers/samplers/sphere_samplers/tests/test_point_sampler.py ______________________________________________________________
ImportError while importing test module '/Users/sobolp/Documents/dev/morphosamplers/src/morphosamplers/samplers/sphere_samplers/tests/test_point_sampler.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../micromamba/envs/morpho-dev/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
src/morphosamplers/samplers/sphere_samplers/tests/test_point_sampler.py:4: in <module>
    from morphosamplers import MorphoModels
E   ImportError: cannot import name 'MorphoModels' from 'morphosamplers' (/Users/sobolp/Documents/dev/morphosamplers/src/morphosamplers/__init__.py)
============================================================================================== short test summary info ==============================================================================================
ERROR src/morphosamplers/samplers/path_samplers/tests/test_point_sampler_equidistant.py
ERROR src/morphosamplers/samplers/path_samplers/tests/test_pose_sampler_parallel.py
ERROR src/morphosamplers/samplers/sphere_samplers/tests/test_point_sampler.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================================= 3 errors in 0.77s =================================================================================================
psobolewskiPhD commented 4 months ago

Here's the issue: https://github.com/morphometrics/morphosamplers/blob/82fe35c88c33edad55c2ec5cd4c591f89bd73c9e/pyproject.toml#L139

So running just pytest only runs that one folder of tests and this is what is used on CI. All the other tests arn't being run.