Description
I had meet a problem when running code with pytest 8.2.2 that test are importing modules from source, not from the installed version of package, that leads to test fail, as the package contains modules that need to be downgraded.
==================================== ERRORS ====================================
_________________ ERROR collecting mahotas/tests/test_bbox.py __________________
ImportError while importing test module '/project/mahotas/tests/test_bbox.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/project/mahotas/tests/test_bbox.py:4: in <module>
from mahotas import bbox
/project/mahotas/bbox.py:8: in <module>
from . import _bbox
E ImportError: cannot import name '_bbox' from 'mahotas' (/project/mahotas/__init__.py)
https://github.com/luispedro/mahotas/actions/runs/9771967420/job/26975569344#step:3:994
However, when downgrade to pytest 8.1.1 it works again:
https://github.com/luispedro/mahotas/actions/runs/9873149918/job/27264790877?pr=149
luispedro/mahotas#149
I have tried locally to switch to src
layout, but it does not solve the issue.
From simple test it looks like all 8.2.0, 8.2.1 and 8.2.2 are affected.
pytest is invoked with import-mode=importlib
to use code from library, not local version: https://github.com/luispedro/mahotas/blob/5793160940ad88caf3a4113d76f498265d4b3d06/pyproject.toml#L7
maybe you could see an obvious problem with project configuration, but it worked in the past.