Closed kloczek closed 3 weeks ago
BTW it is yest another issue related to use "test as installed" testing.
zmq
is using relative imports which forces to have exact relative location of the zmq
I have patch which removes use of those relative imports. Do you want to me to submit that patch as PR to review an/or merge? 🤔
I don't believe this is related to relative imports, since the file is not part of the pyzmq package and unrelated to installation and also not a relative import. It is part of the test suite, which pytest puts on sys.path by default. You've opted out of pytest's standard behavior with --import-mode=importlib
, which is what prevents it from working. Removing that argument to leave pytest to its own standard behavior is the simplest fix.
I can make a patch to allow importlib to work as well.
This is a pyzmq bug
What pyzmq version?
26.1.1
What libzmq version?
4.3.5
Python version (and how it was installed)
3.10.14
OS
Linux
What happened?
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesinstaller
modulecut off from access to the public network
(pytest is executed with-m "not network"
)Looks like ATM pytest fails because missing
zmq_test_utils
module.Code to reproduce bug
Here is pytest output:
```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-zmq-26.1.1-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-zmq-26.1.1-2.fc37.x86_64/usr/lib/python3.10/site-packages + /usr/bin/pytest -ra -m 'not network' --import-mode=importlib ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.10.14, pytest-8.2.2, pluggy-1.5.0 rootdir: /home/tkloczko/rpmbuild/BUILD/pyzmq-26.1.1 configfile: pytest.ini testpaths: tests plugins: asyncio-0.23.8 asyncio: mode=auto collected 114 items / 22 errors / 1 skipped ========================================================================================== ERRORS =========================================================================================== ____________________________________________________________________________ ERROR collecting tests/test_auth.py ____________________________________________________________________________ ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/pyzmq-26.1.1/tests/test_auth.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: tests/test_auth.py:17: inMore info
List of installed modules in build env:
```console Package Version ----------------------------- ----------- alabaster 0.7.16 apeye 1.4.1 apeye-core 1.1.4 autodocsumm 0.2.13 Babel 2.15.0 beautifulsoup4 4.12.3 build 1.2.1 CacheControl 0.14.0 cffi 1.16.0 charset-normalizer 3.3.2 cssutils 2.11.1 Cython 3.0.11 defusedxml 0.7.1 dict2css 0.3.0.post1 distro 1.9.0 docutils 0.20.1 domdf_python_tools 3.8.0.post2 enum-tools 0.12.0 exceptiongroup 1.1.3 filelock 3.15.4 gevent 24.2.1 greenlet 3.0.3 html5lib 1.1 imagesize 1.4.1 importlib_metadata 8.0.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.4 linkify-it-py 2.0.3 markdown-it-py 3.0.0 MarkupSafe 2.1.5 mdit-py-plugins 0.4.1 mdurl 0.1.2 more-itertools 10.3.0 msgpack 1.0.8 myst-parser 4.0.0 natsort 8.4.0 packaging 24.0 pathspec 0.12.1 platformdirs 4.2.2 pluggy 1.5.0 ply 3.11 pycparser 2.22 Pygments 2.18.0 pyproject_hooks 1.0.0 pyproject-metadata 0.8.0 pytest 8.2.2 pytest-asyncio 0.23.8 python-dateutil 2.9.0.post0 PyYAML 6.0.2 requests 2.32.3 ruamel.yaml 0.18.5 ruamel.yaml.clib 0.2.8 scikit_build_core 0.9.8 setuptools 72.2.0 setuptools-scm 8.1.0 snowballstemmer 2.2.0 soupsieve 2.6 Sphinx 8.0.2 sphinx-autodoc-typehints 2.2.3 sphinx-jinja2-compat 0.3.0 sphinx-prompt 1.6.0 sphinx_rtd_theme 2.0.1a1 sphinx-tabs 3.4.5 sphinx-toolbox 3.8.0 sphinxcontrib-applehelp 1.0.8 sphinxcontrib-devhelp 1.0.6 sphinxcontrib-htmlhelp 2.0.5 sphinxcontrib-jquery 4.1 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.7 sphinxcontrib-serializinghtml 2.0.0 tabulate 0.9.0 tokenize_rt 6.0.0 tomli 2.0.1 tornado 6.4.1 typing_extensions 4.12.2 uc-micro-py 1.0.3 urllib3 2.2.2 webencodings 0.5.1 wheel 0.44.0 zipp 3.19.2 zope.event 5.0 zope.interface 7.0.1 ```