spin: spin test does not work with an editable install
After an editable install spin install running spin test fails:
$ spin test
Invoking `build` prior to running tests:
Editable install of same source detected; skipping build
Editable install of same source directory detected; not setting PYTHONPATH
$ /home/oscar/.pyenv/versions/3.11.3/envs/cython_coverage_demo-3.11.git/bin/python3.11 -P -c 'import stuff'
$ /home/oscar/.pyenv/versions/3.11.3/envs/cython_coverage_demo-3.11.git/bin/python3.11 -P -m pytest stuff
======================================== test session starts ========================================
platform linux -- Python 3.11.3, pytest-8.2.0, pluggy-1.5.0
rootdir: /home/oscar/current/active/cython_coverage_demo
configfile: pyproject.toml
plugins: cov-5.0.0
collected 0 items
======================================= no tests ran in 0.01s =======================================
ERROR: file or directory not found: stuff
It is trying to run pytest stuff when the command should be pytest --pyargs stuff:
$ pytest --pyargs stuff
======================================== test session starts ========================================
platform linux -- Python 3.11.3, pytest-8.2.0, pluggy-1.5.0
rootdir: /home/oscar/current/active/cython_coverage_demo
configfile: pyproject.toml
plugins: cov-5.0.0
collected 1 item
src/stuff/test_thing.py . [100%]
========================================= 1 passed in 0.11s =========================================
$ spin run pytest --pyargs stuff
======================================== test session starts ========================================
platform linux -- Python 3.11.3, pytest-8.2.0, pluggy-1.5.0
rootdir: /home/oscar/current/active/cython_coverage_demo
configfile: pyproject.toml
plugins: cov-5.0.0
collected 1 item
src/stuff/test_thing.py . [100%]
========================================= 1 passed in 0.11s =========================================
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (12 by maintainers)
Commits related to this issue
- Use --pyargs to select package to test Also do not switch out of source path when running tests. - Allow testing src/ layout tests - Better support editable install tests See #185 — committed to stefanv/spin by stefanv 3 years ago
- Use --pyargs to select package to test (#191) Also do not switch out of source path when running tests. - Allow testing src/ layout tests - Better support editable install tests See #185 — committed to scientific-python/spin by stefanv 2 years ago
This should be closed by #191
Glad to hear, it was a bit of a wild guess but it worked 🎉