ftnext / rye-workspace-example

MIT License
1 stars 0 forks source link

pytest: ImportError; ModuleNotFoundError: No module named 'tests.test_fabulous' #2

Closed ftnext closed 8 months ago

ftnext commented 8 months ago
% rye run pytest  
================================== test session starts ==================================
platform darwin -- Python 3.12.0, pytest-8.0.1, pluggy-1.4.0
rootdir: /.../rye-workspace-example
collected 1 item / 1 error                                                              

======================================== ERRORS =========================================
___________________ ERROR collecting fabulous/tests/test_fabulous.py ____________________
ImportError while importing test module '/.../rye-workspace-example/fabulous/tests/test_fabulous.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../.rye/py/cpython@3.12.0/install/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
E   ModuleNotFoundError: No module named 'tests.test_fabulous'
================================ short test summary info ================================
ERROR fabulous/tests/test_fabulous.py
!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!
=================================== 1 error in 0.04s ====================================
ftnext commented 8 months ago

Specify --import-mode importlib https://scrapbox.io/nikkie-memos/Rye%E3%81%AEworkspace%E3%81%AEpytest%E3%81%A7ModuleNotFoundError