-
Notifications
You must be signed in to change notification settings - Fork 1
[JOSS] pytest doesn't run on Python 3.14 #40
Description
I tested python 3.12 and 3.14, it runs fine on 3.12. I was confused why the GitHub CI passed when it failed in my computer, so I tested 3.12 as well. The problem could be unrelated to your code, but try to see if there is something you can do. The details I gathered from my testing could be useful (see below).
Also, I saw that src/scrollstats/ridge_metrics/calc_ridge_metrics.py has 0% coverage on your tests, and that is one of the main output of the program, please add a test for that.
I tried running pytest and pytest --cov=scrollstats in both main and joss-review branch, and it did not run. See the stdout/err below:
============================================================================ test session starts =============================================================================
platform linux -- Python 3.14.3, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/user/scrollstats
configfile: pyproject.toml
testpaths: tests
plugins: cov-7.0.0
collected 1 item / 1 error
=================================================================================== ERRORS ===================================================================================
____________________________________________________________________ ERROR collecting tests/test_core.py _____________________________________________________________________
ImportError while importing test module '/home/user/scrollstats/tests/test_core.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.14/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_core.py:20: in <module>
from scrollstats.delineation import (
E ImportError: cannot import name 'create_ridge_area_raster' from 'scrollstats.delineation' (/home/user/scrollstats/src/scrollstats/delineation/__init__.py). Did you mean: 'create_ridge_area_raster_fs'?
========================================================================== short test summary info ===========================================================================
ERROR tests/test_core.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================== 1 error in 0.76s ==============================================================================
I can see that the CI passed in the GitHub commit, so I don't know what is leading into this, I tried a few things:
import scrollstats as sc
dir(sc.delineation)gives:
['LineSmoother', 'create_ridge_area_raster', 'create_ridge_area_raster_fs', 'quadratic_profile_curvature', 'residual_topography']
But doing:
from scrollstats.delineation import create_ridge_area_raster
gives the same error:
Traceback (most recent call last):
File "<python-input-4>", line 1, in <module>
from scrollstats.delineation import create_ridge_area_raster
ImportError: cannot import name 'create_ridge_area_raster' from 'scrollstats.delineation' (/home/user/scrollstats/src/scrollstats/delineation/__init__.py). Did you mean: 'create_ridge_area_raster_fs'?
While trying to access the function from delineation
sc.delineation.create_ridge_area_rastergives:
Traceback (most recent call last):
File "<python-input-5>", line 1, in <module>
sc.delineation.create_ridge_area_raster
File "/home/user/scrollstats/venv/lib/python3.14/site-packages/lazy_loader/__init__.py", line 78, in __getattr__
submod = importlib.import_module(submod_path)
File "/usr/lib/python3.14/importlib/__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1398, in _gcd_import
File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 759, in exec_module
File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
File "/home/user/scrollstats/src/scrollstats/delineation/ridge_area_raster.py", line 15, in <module>
from .array_types import (
...<5 lines>...
)
File "/home/user/scrollstats/src/scrollstats/delineation/array_types.py", line 6, in <module>
from nptyping import Bool, Float, NDArray, Shape
File "/home/user/scrollstats/venv/lib/python3.14/site-packages/nptyping/__init__.py", line 30, in <module>
from nptyping.ndarray import NDArray
File "/home/user/scrollstats/venv/lib/python3.14/site-packages/nptyping/ndarray.py", line 32, in <module>
from nptyping.shape_expression import (
...<3 lines>...
)
File "/home/user/scrollstats/venv/lib/python3.14/site-packages/nptyping/shape_expression.py", line 35, in <module>
from nptyping.typing_ import Literal
File "/home/user/scrollstats/venv/lib/python3.14/site-packages/nptyping/typing_.py", line 66, in <module>
Bool8: TypeAlias = np.bool8
^^^^^^^^
File "/home/user/scrollstats/venv/lib/python3.14/site-packages/numpy/__init__.py", line 792, in __getattr__
raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
AttributeError: module 'numpy' has no attribute 'bool8'. Did you mean: 'bool'?
Related: openjournals/joss-reviews#9736