Closed kloczek closed 3 years ago
Probably move src/sphinxcontrib/ to sphinxcontrib/ may help.
No. This is a very bad idea and is highly discouraged. You should always test software as installed and not a git checkout that happens to be in the import path by accident, just because you invoke pytest
via python -m
. pip install
it, and then it'll be importable.
P.S. IIRC you package for Fedora so just use https://src.fedoraproject.org/rpms/pyproject-rpm-macros which should make it easier for you to automatically extract and run everything necessary.
Issue is that my rpm %pytest macro points to already installed module. Longer part of the build log:
+ /usr/bin/python3 setup.py install -O1 --skip-build --root /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64
running install
running install_lib
creating /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr
creating /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib
creating /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8
creating /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages
creating /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib
creating /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier
copying build/lib/sphinxcontrib/towncrier/__init__.py -> /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier
copying build/lib/sphinxcontrib/towncrier/_towncrier.py -> /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier
copying build/lib/sphinxcontrib/towncrier/_version.py -> /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier
copying build/lib/sphinxcontrib/towncrier/_scm_version.py -> /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier
byte-compiling /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier/__init__.py to __init__.cpython-38.pyc
byte-compiling /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier/_towncrier.py to _towncrier.cpython-38.pyc
byte-compiling /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier/_version.py to _version.cpython-38.pyc
byte-compiling /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier/_scm_version.py to _scm_version.cpython-38.pyc
writing byte-compilation script '/tmp/tmpaxbp2a0r.py'
/usr/bin/python3 /tmp/tmpaxbp2a0r.py
removing /tmp/tmpaxbp2a0r.py
running install_egg_info
running egg_info
writing src/sphinxcontrib_towncrier.egg-info/PKG-INFO
writing dependency_links to src/sphinxcontrib_towncrier.egg-info/dependency_links.txt
writing requirements to src/sphinxcontrib_towncrier.egg-info/requires.txt
writing top-level names to src/sphinxcontrib_towncrier.egg-info/top_level.txt
package init file 'src/sphinxcontrib/__init__.py' not found (or not a regular file)
reading manifest file 'src/sphinxcontrib_towncrier.egg-info/SOURCES.txt'
writing manifest file 'src/sphinxcontrib_towncrier.egg-info/SOURCES.txt'
Copying src/sphinxcontrib_towncrier.egg-info to /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib_towncrier-0.2.0a0-py3.8.egg-info
running install_scripts
+ /usr/bin/rm -rfv /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/bin/__pycache__
+ /usr/lib/rpm/find-debuginfo.sh -j48 --strict-build-id -m -i --build-id-seed 0.2.0a0-2.fc35 --unique-debug-suffix -0.2.0a0-2.fc35.x86_64 --unique-debug-src-base python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64 --run-dwz --dwz-low-mem-die-limit none --dwz-max-die-limit 110000000 -S debugsourcefiles.list /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
find: 'debug': No such file or directory
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-lto /usr/bin/strip
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ '[' -f /usr/bin/python3 ']'
+ PYTHONPATH=/usr/lib/rpm/redhat
+ PYTHONHASHSEED=0
+ /usr/bin/python3 -s -B -m compileall2 -f -j48 -o 0 -o 1 -o 2 -s /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64 -p / /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib64/python3.8/site-packages /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages
Listing '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib64/python3.8/site-packages'...
Can't list '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib64/python3.8/site-packages'
Listing '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages'...
Listing '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib'...
Listing '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier'...
Compiling '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier/__init__.py'...
Compiling '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier/_scm_version.py'...
Listing '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib_towncrier-0.2.0a0-py3.8.egg-info'...
Compiling '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier/_towncrier.py'...
Compiling '/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/towncrier/_version.py'...
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.RFHpfH
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ cd sphinxcontrib-towncrier-0.2.0a0
+ CFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none'
+ CXXFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none'
+ FFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules'
+ FCFLAGS='-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules'
+ LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin'
+ CC=/usr/bin/gcc
+ CXX=/usr/bin/g++
+ FC=/usr/bin/gfortran
+ AR=/usr/bin/gcc-ar
+ NM=/usr/bin/gcc-nm
+ RANLIB=/usr/bin/gcc-ranlib
+ export CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS CC CXX FC AR NM RANLIB
+ PATH=/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/bin:/usr/bin:/usr/sbin:/usr/local/sbin
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-towncrier-0.2.0a0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/python3 -Bm pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.9, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/.hypothesis/examples')
rootdir: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0, configfile: pytest.ini, testpaths: tests/
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, httpbin-1.0.0, xdist-2.2.1, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, cases-3.4.6, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, asyncio-0.15.1, toolbox-0.5, xprocess-0.17.1, aiohttp-0.3.0, checkdocs-2.7.0, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, Faker-8.4.0, cov-2.12.1, pyfakefs-4.5.0, hypothesis-6.13.14
[gw0] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw1] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw2] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw3] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw4] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw5] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw6] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw7] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw8] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw9] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw10] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw11] linux Python 3.8.9 cwd: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0
[gw0] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw1] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw3] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw2] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw4] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw5] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw6] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw7] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw9] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw8] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw10] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
[gw11] Python 3.8.9 (default, Apr 7 2021, 13:42:48) -- [GCC 11.0.1 20210324 (Red Hat 11.0.1-0)]
gw0 [0] / gw1 [0] / gw2 [0] / gw3 [0] / gw4 [0] / gw5 [0] / gw6 [0] / gw7 [0] / gw8 [0] / gw9 [0] / gw10 [0] / gw11 [0]
scheduling tests via LoadScheduling
================================================================================== ERRORS ==================================================================================
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f967cc57220>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f967cc57220>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7ff5869e6280>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7ff5869e6280>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fe33a4312b0>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fe33a4312b0>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fbe3085a280>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fbe3085a280>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fc3249bd310>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fc3249bd310>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fdd527752b0>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fdd527752b0>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f5a35fa32b0>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f5a35fa32b0>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f47d87fd310>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f47d87fd310>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f4a1aa002e0>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f4a1aa002e0>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f4edfade250>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f4edfade250>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f689496b2b0>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f689496b2b0>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
__________________________________________________________________ ERROR collecting tests/version_test.py __________________________________________________________________
tests/version_test.py:2: in <module>
from sphinxcontrib.towncrier import __version__
E ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
__builtins__ = <builtins>
__cached__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/__pycache__/version_test.cpython-38.pyc'
__doc__ = 'Version tests.'
__file__ = '/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py'
__loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fc84ad71310>
__name__ = 'version_test'
__package__ = ''
__spec__ = ModuleSpec(name='version_test', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7fc84ad71310>, origin='/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/tests/version_test.py')
---------------------------- generated xml file: /home/tkloczko/rpmbuild/BUILD/sphinxcontrib-towncrier-0.2.0a0/.test-results/pytest/results.xml ----------------------------
========================================================================= short test summary info ==========================================================================
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
ERROR tests/version_test.py - ModuleNotFoundError: No module named 'sphinxcontrib.towncrier'
============================================================================ 13 errors in 5.09s ============================================================================
/usr/bin/python3 setup.py install
Do not do this. You must rely on PEP 517 to invoke the build. Otherwise, you probably end up using different mechanisms and may be missing out. But I don't have any motivation to debug that. Use the proper macros as I've pointed out earlier and test as installed, not in the checkout.
I should probably just remove setup.py
so that people wouldn't be tempted to do the wrong thing...
/usr/bin/python3 setup.py install
Do not do this. You must rely on PEP 517 to invoke the build. Otherwise, you probably end up using different mechanisms and may be missing out. But I don't have any motivation to debug that. Use the proper macros as I've pointed out earlier and test as installed, not in the checkout.
AFAIK pep517 is module which only provides build. Looking on directory content:
[tkloczko@barrel SRPMS]$ ls -1 /usr/lib/python3.8/site-packages/pep517/
build.py
check.py
colorlog.py
compat.py
dirtools.py
envbuild.py
__init__.py
in_process
meta.py
__pycache__
wrappers.py
I don't see anything like install.py.
So show exactly this should be used?
I should probably just remove
setup.py
so that people wouldn't be tempted to do the wrong thing...
So what is the RightWay™️ for build, install and test?
It's all written here https://src.fedoraproject.org/rpms/pyproject-rpm-macros under the "Usage" title. The instructions include generating the build requirements, building the wheel, installing it, and invoking tox
tests (although, we don't currently have any useful tests right now so this doesn't really matter atm).
AFAIK pep517 is module which only provides build.
It's a library that knows how to invoke the proper PEP517 hooks in order to extract the build deps and build an sdist and a wheel. It has a CLI which mustn't be used (because it was supposed to be experimental and is now being removed). Instead, the official guidance is to use https://github.com/pypa/build which AFAIU isn't yet packaged for Fedora. These may optionally pre-populate a virtualenv for the build but there's a flag for avoiding it.
OTOH you should just use pyproject-rpm-macros which doesn't need pypa/build.
This is the right way.
Also, setup.py install
has been discouraged for years because it produces a "broken" install w/o enough metadata for the tooling to know which files belong to a given package. This basically means that it puts undeletable files in places and nothing knows about them.
Also,
setup.py install
has been discouraged for years because it produces a "broken" install w/o enough metadata for the tooling to know which files belong to a given package. This basically means that it puts undeletable files in places and nothing knows about them.
I have now packaged about 520 pythin modules and so far did not found any issues with metadata. I would be appresiated if you would be able to point on exact case or cases when package is installed w/o enough metadata. Nevertheless I do not care about python module metadata like manifest because actual list of files which belongs to pythom module (if you are taling about some missing bits in exaxtly taht metadata) is in my case in rpm package.
FY: In mean time I found kind of workaround for exactly thos case.
Looks like pytest actually prints error about missing sphinxcontrib.towncrier
not because it cannot find that module but because it cannot wind sphinxcontrib/init.py`.
Workaroud for that is:
build
create empty __init__.py
(> build/lib/sphinxcontrib/__init__.py
)So my actual build procedure for your package looks like that:
%build
%py3_build
> build/lib/sphinxcontrib/__init__.py
%install
%py3_install
%check
%pytest
%files
%{python3_sitelib}/sphinxcontrib/towncrier
%{python3_sitelib}/sphinxcontrib_towncrier-*.egg-info
%exclude %{python3_sitelib}/sphinxcontrib/*.py
%exclude %{python3_sitelib}/sphinxcontrib/__pycache__
I have no idea why python loading subdirectory/module
needs to touch subdirectory/init.py and if it cannot find that (even empty) file prints misleading message that was not possible to find subdirectory.module
.
If you have any suggestions about why pytest is failing and/or is it could be pytest or python issue please let me know.
sphinxcontrib-towncrier
module is already second module in my packages stash which needs exactly that kind of workaround.
Looks like pytest is failing because it cannot find in project root sphinxcontrib.towncrier. Probably move src/sphinxcontrib/ to sphinxcontrib/ may help.