
Am 21.05.21 um 12:48 schrieb pgajdos:
%check %python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python setup.py test %pytest_arch
So you run the tests twice? Does %pytest_arch here really succeed? But without setup.py tests before it does not? Am 21.05.21 um 14:40 schrieb pgajdos:
On Fri, May 21, 2021 at 12:48:10PM +0200, pgajdos wrote:
Hello,
I have following issue I have met second time now and I would like to ask you for an explanation and possibly for an advice.
In other words:
:/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # export PYTHONPATH=/home/abuild/rpmbuild/BUILDROOT/python-bitstruct-8.11.0-0.x86_64/usr/lib64/python3.9/site-packages :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # export PYTHONDONTWRITEBYTECODE=1 :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # strace -f -s512 pytest-3.9 --ignore=_build.python36 --ignore=_build.python39 --ignore=_build.python38 -v > strace.log 2>&1 :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # grep 'bitstruct.*\.so' strace.log newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/tests/__init__.cpython-39-x86_64-linux-gnu.so", 0x7ffdb56b5310, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/tests/__init__.abi3.so", 0x7ffdb56b5310, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/tests/__init__.so", 0x7ffdb56b5310, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/__init__.cpython-39-x86_64-linux-gnu.so", 0x7ffdb56b4f20, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/__init__.abi3.so", 0x7ffdb56b4f20, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/__init__.so", 0x7ffdb56b4f20, 0) = -1 ENOENT (No such file or directory) :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 #
:/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # cp build/lib.linux-x86_64-3.9/bitstruct/c.cpython-39-x86_64-linux-gnu.so bitstruct :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # strace -f -s512 pytest-3.9 --ignore=_build.python36 --ignore=_build.python39 --ignore=_build.python38 -v > strace.log 2>&1 :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # vim strace.log (failed reverse-i-search)`sed': vim ^Crace.log :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # grep 'bitstruct.*\.so' strace.log newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/c.cpython-39-x86_64-linux-gnu.so", {st_mode=S_IFREG|0755, st_size=142960, ...}, 0) = 0 newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/c.cpython-39-x86_64-linux-gnu.so", {st_mode=S_IFREG|0755, st_size=142960, ...}, 0) = 0 newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/c.cpython-39-x86_64-linux-gnu.so/bin", 0x7ffe5fab9550, 0) = -1 ENOTDIR (Not a directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/tests/__init__.cpython-39-x86_64-linux-gnu.so", 0x7ffe5fab8270, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/tests/__init__.abi3.so", 0x7ffe5fab8270, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/tests/__init__.so", 0x7ffe5fab8270, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/__init__.cpython-39-x86_64-linux-gnu.so", 0x7ffe5fab7e80, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/__init__.abi3.so", 0x7ffe5fab7e80, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/__init__.so", 0x7ffe5fab7e80, 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/c.cpython-39-x86_64-linux-gnu.so", {st_mode=S_IFREG|0755, st_size=142960, ...}, 0) = 0 openat(AT_FDCWD, "/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0/bitstruct/c.cpython-39-x86_64-linux-gnu.so", O_RDONLY|O_CLOEXEC) = 11 :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # grep '^======' strace.log ============================== 49 passed in 0.33s ============================== :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 #
:/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 # ls /home/abuild/rpmbuild/BUILDROOT/python-bitstruct-8.11.0-0.x86_64/usr/lib64/python3.9/site-packages/bitstruct __init__.py __pycache__ c.cpython-39-x86_64-linux-gnu.so version.py :/home/abuild/rpmbuild/BUILD/bitstruct-8.11.0 #
Petr
Both strace.log show that the import is from BUILD, not from BUILDROOT. So even although you have PYTHONPATH=...BUILDROOT..., the tests still try to import from BUILD (cwd). - check whether the config file for pytest (setup.cfg, pytest.ini, tox.ini, it is reported in the header) modify the import mode. - Check whether conftest.py or any other code tamper with sys.path. * try different pytest --import-mode parameters * Nuclear option: rename/remove the bitstruct directory in BUILD, so that the bitstruct module is really imported from BUILDROOT For future reference: Be clear whethe you use %pytest pr %pytest_arch. Different PYTHONPATH settings. purelib (/usr/lib) vs platlib (%{_libdir}, /usr/lib64). Cheers, Ben