pytest-dev / pytest-dev/pytest
Pytest fails to find some libraries
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
While trying to run pytest on the TA-Lib project (and many other projects) it fails to find this library:
cd /usr/ports/finance/py-ta-lib/work-py39/TA-Lib-0.4.26/talib && /usr/bin/env XDG_DATA_HOME=/usr/ports/finance/py-ta-lib/work-py39 XDG_CONFIG_HOME=/usr/ports/finance/py-ta-lib/work-py39 XDG_CACHE_HOME=/usr/ports/finance/py-ta-lib/work-py39/.cache HOME=/usr/ports/finance/py-ta-lib/work-py39 PATH=/usr/local/libexec/ccache:/usr/ports/finance/py-ta-lib/work-py39/.bin:/home/yuri/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin PKG_CONFIG_LIBDIR=/usr/ports/finance/py-ta-lib/work-py39/.pkgconfig:/usr/local/libdata/pkgconfig:/usr/local/share/pkgconfig:/usr/libdata/pkgconfig MK_DEBUG_FILES=no MK_KERNEL_SYMBOLS=no SHELL=/bin/sh NO_LINT=YES LDSHARED="cc -shared" PYTHONDONTWRITEBYTECODE= PYTHONOPTIMIZE= PREFIX=/usr/local LOCALBASE=/usr/local CC="cc" CFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing " CPP="cpp" CPPFLAGS="" LDFLAGS=" -fstack-protector-strong " LIBS="" CXX="c++" CXXFLAGS="-O2 -pipe -fstack-protector-strong -fno-strict-aliasing " MANPREFIX="/usr/local" CCACHE_DIR="/tmp/.ccache" BSD_INSTALL_PROGRAM="install -s -m 555" BSD_INSTALL_LIB="install -s -m 0644" BSD_INSTALL_SCRIPT="install -m 555" BSD_INSTALL_DATA="install -m 0644" BSD_INSTALL_MAN="install -m 444" PYTHONPATH=/usr/ports/finance/py-ta-lib/work-py39/stage/usr/local/lib/python3.9/site-packages /usr/local/bin/python3.9 -m pytest -k '' -rs -v -o addopts=
========================================================================================== test session starts ==========================================================================================
platform freebsd13 -- Python 3.9.16, pytest-7.2.2, pluggy-1.0.0 -- /usr/local/bin/python3.9
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/usr/ports/finance/py-ta-lib/work-py39/TA-Lib-0.4.26/talib/.hypothesis/examples')
Using --randomly-seed=1501004421
rootdir: /usr/ports/finance/py-ta-lib/work-py39/TA-Lib-0.4.26
plugins: forked-1.4.0, hypothesis-6.70.0, mypy-plugins-1.10.1, cov-2.9.0, xdist-2.5.0, randomly-3.12.0, timeout-2.1.0, rerunfailures-10.1, flaky-3.7.0, env-0.6.2, freezegun-0.4.2, mock-3.10.0
collected 0 items / 6 errors
================================================================================================ ERRORS =================================================================================================
________________________________________________________________________________ ERROR collecting talib/test_abstract.py ________________________________________________________________________________
ImportError while importing test module '/usr/ports/finance/py-ta-lib/work-py39/TA-Lib-0.4.26/talib/test_abstract.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
__init__.py:93: in <module>
from ._ta_lib import (
E ModuleNotFoundError: No module named 'talib._ta_lib'
__________________________________________________________________________________ ERROR collecting talib/test_data.py __________________________________________________________________________________
talib._ta_lib is installed into a system-wide directory (/usr/local/lib/python3.9/site-packages/talib/_ta_lib.cpython-39.so), and import talib succeeds in Python.
py39-pytest-7.2.2,1
Python-3.9
FreeBSD 13.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the supplied pytest command and inspect collection of talib/test_abstract.py and talib/test_data.py, focusing on why talib._ta_lib is unavailable during collection despite succeeding in a direct Python import. Compare the test runner's import environment with the system-wide site-packages location; done means identifying a reproducible pytest-side cause and a regression test or documented resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100