-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
26.0.3 [BUG]: pytest fails in zmq/backend/cython/_zmq.py in cython.compiled
import
#1992
Comments
As the error says, this means pyzmq is imported from the source directory and hasn't been built yet. However you build or install pyzmq, make sure that's imported. To run from source, do:
|
pep517 based procedure does not build in-palce. --- a/zmq/__init__.py
+++ b/zmq/__init__.py
@@ -51,8 +51,8 @@
with _libs_on_path():
from zmq import backend
-from . import constants # noqa
-from .constants import * # noqa
+from zmq import constants # noqa
+from zmq.constants import * # noqa
from zmq.backend import * # noqa
from zmq import sugar
from zmq.sugar import * # noqa
--- a/zmq/__init__.pyi
+++ b/zmq/__init__.pyi
@@ -1,6 +1,6 @@
from typing import List
-from . import backend, sugar
+from zmq import backend, sugar
COPY_THRESHOLD: int
DRAFT_API: bool
@@ -11,19 +11,19 @@
# see tools/backend_imports.py to generate this list
# note: `x as x` is required for re-export
# see https://github.com/python/mypy/issues/2190
-from .backend import IPC_PATH_MAX_LEN as IPC_PATH_MAX_LEN
-from .backend import curve_keypair as curve_keypair
-from .backend import curve_public as curve_public
-from .backend import device as device
-from .backend import has as has
-from .backend import proxy as proxy
-from .backend import proxy_steerable as proxy_steerable
-from .backend import strerror as strerror
-from .backend import zmq_errno as zmq_errno
-from .backend import zmq_poll as zmq_poll
-from .constants import *
-from .error import *
-from .sugar import *
+from zmq.backend import IPC_PATH_MAX_LEN as IPC_PATH_MAX_LEN
+from zmq.backend import curve_keypair as curve_keypair
+from zmq.backend import curve_public as curve_public
+from zmq.backend import device as device
+from zmq.backend import has as has
+from zmq.backend import proxy as proxy
+from zmq.backend import proxy_steerable as proxy_steerable
+from zmq.backend import strerror as strerror
+from zmq.backend import zmq_errno as zmq_errno
+from zmq.backend import zmq_poll as zmq_poll
+from zmq.constants import *
+from zmq.error import *
+from zmq.sugar import *
def get_includes() -> list[str]: ...
def get_library_dirs() -> list[str]: ...
--- a/zmq/backend/__init__.py
+++ b/zmq/backend/__init__.py
@@ -6,7 +6,7 @@
import os
import platform
-from .select import public_api, select_backend
+from zmq.backend.select import public_api, select_backend
if 'PYZMQ_BACKEND' in os.environ:
backend = os.environ['PYZMQ_BACKEND']
--- a/zmq/backend/__init__.pyi
+++ b/zmq/backend/__init__.pyi
@@ -4,7 +4,7 @@
import zmq
-from .select import select_backend
+from zmq.backend.select import select_backend
# avoid collision in Frame.bytes
_bytestr = bytes
--- a/zmq/backend/cython/__init__.py
+++ b/zmq/backend/cython/__init__.py
@@ -3,11 +3,11 @@
# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
-from . import _zmq
+from zmq.backend.cython import _zmq
# mq not in __all__
-from ._zmq import * # noqa
-from ._zmq import monitored_queue # noqa
+from zmq.backend.cython._zmq import * # noqa
+from zmq.backend.cython._zmq import monitored_queue # noqa
Message = _zmq.Frame
I'm using typical procedure used on package python modules as rpm package consisting from:
pep517 stores all temporary files in build/ and not in source tree. Please have look one more time what is imported in zmq/backend/cython/_zmq.py. |
I think I need to work on the error message, because this is precisely the situation it is for. If To load tests from an installed package instead of a source tree with pytest (not specific to pyzmq), use Now that BaseZMQTestCase has been deprecated for a while, I can probably safely move the tests outside of the package, which I think should also avoid this issue. |
Moving test outside module tree definitely it is good move 👍 Please consider remove as well relative imports. Default pytest args woild be good be good to put in pyproject.toml or pytest.ini. |
The only thing required to test against an install is to tell pytest to find the tests in the package:
No patches or anything. Note that I think #1994 resolves all of this, removing the |
This is a pyzmq bug
What pyzmq version?
26.0.3
What libzmq version?
4.3.5
Python version (and how it was installed)
3.11.14
OS
Linux/x86_64
What happened?
Looks like pytest fails in zmq/backend/cython/_zmq.py in
cython.compiled
import. below taht is another import ofcython.cimports.cpython
and there is no such module as well incython
3.0.10 there is no such module.List of installed modules in build env:
Code to reproduce bug
Traceback, if applicable
More info
No response
The text was updated successfully, but these errors were encountered: