[Numpy-discussion] How to run unittests at build time?

Filipe Pires Alvarenga Fernandes ocefpaf@gmail....
Wed Sep 21 18:08:21 CDT 2011


On Wed, Sep 21, 2011 at 17:29, Sandro Tosi <morph@debian.org> wrote:
> On Wed, Sep 21, 2011 at 23:20, Robert Kern <robert.kern@gmail.com> wrote:
>> On Wed, Sep 21, 2011 at 16:15, Filipe Pires Alvarenga Fernandes
>> <ocefpaf@gmail.com> wrote:
>>> Don't know about about Debian, but this works OK for RPM distros:
>>>
>>> PYTHONPATH="%{buildroot}%{py_sitedir}" %{__python} -c \
>>>                                    "import pkg_resources, numpy ; numpy.test()"
>>>
>>> The only thing you are missing is the "import pkg_resources", let me
>>> know if that works for you.
>>
>> What does py_sitedir expand to, usually?
>
> I suppose the site-packages directory location, so something like
> /usr/lib/python2.6/site-packages/

Yep. That's correct.

If you want to look at the whole spec file:
https://build.opensuse.org/package/view_file?file=python-numpy.spec&package=python-numpy&project=home%3Aocefpaf&srcmd5=ffa9c6e1b9a6f715f0101eb334c5b5a8


>> I don't think pkg_resources
>> has anything to do with it. numpy doesn't use it, and I don't think
>> nosetests does either (well, only for its plugin mechanism, but that's
>> neither here nor there).
>
> ack, I didn't use it in my tests: it works fine the python -c "import
> numpy; numpy.test()"
>
>> In any case, I've tried importing
>> pkg_resources while running from the build/lib.*/ directory and still
>> get the same errors as reported by Sandro.

You are right, I just removed pkg_resources and things still work OK.

> Yep, the different with my approach and Felipe's one is I ran from the
> build directory Felipe from the installation directory. It works, so
> I'll use the latter
>
> Cheers,
> --
> Sandro Tosi (aka morph, morpheus, matrixhasu)
> My website: http://matrixhasu.altervista.org/
> Me at Debian: http://wiki.debian.org/SandroTosi
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion


More information about the NumPy-Discussion mailing list