[zeromq-dev] error trying to run test suite

MinRK benjaminrk at gmail.com
Fri Nov 19 19:53:32 CET 2010

The way the setup.py test command is written, it requires that you have
built zmq in place, i.e. with:

$> python setup.py build_ext --inplace
$> python setup.py test

If you didn't build that way, you can use the usual test runners, to run the
test suite once you have installed pyzmq, e.g.

$> nosetests -vvs zmq.tests
$> trial zmq.tests

as long as you are *not* in the base directory (the one containing setup.py
and zmq/).

The reason for this is Python's search path priority.  When you say 'import
zmq', Python always looks first in the current directory for a folder called
'zmq', and imports from there if it exists.  When you don't build with
--inplace, then the compiled extensions (all the C/Cython files) are in the
'build/lib...' directory, and not inside the source directory, so when it
tries to import initthreads (zmq/utils/initthreads.so), that file isn't
there, and the import fails.

I updated the binding page to be a bit more clear about inplace builds.


On Fri, Nov 19, 2010 at 10:24, David Arsenault <darsenault at mitre.org> wrote:

> eric <eric <at> ericjbell.com> writes:
> > eric <at> confidence:~/Desktop/pyzmq$ python setup.py test
> ...
> >    File "/home/eric/Desktop/pyzmq/zmq/__init__.py", line 26, in <module>
> >      from zmq.utils import initthreads # initialize threads
> > ImportError: cannot import name initthreads
> >
> Eric,
> I got the same strange error. Did you find any resolution. (I'm on Ubuntu
> 10.10
> with Python 2.6). Thanks
> David
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20101119/84af797a/attachment.htm>

More information about the zeromq-dev mailing list