[pypy-dev] numpypy unit tests

Vincent Legoll vincent.legoll at gmail.com
Sun Jan 3 17:38:12 EST 2016


Hello, to launch a single test you can do it that way, assuming you're
in pypy's top level
and that py.test is installed on your system:

py.test pypy/module/micronumpy/test/test_ndarray.py -k test_array_indexing_bool

On Sun, Jan 3, 2016 at 9:53 PM, Sergey Matyunin
<sergeymatyunin at gmail.com> wrote:
> Thank you, Yury.
> Looks like your lines are already in FAQ. At least I couldn't find
> reasonable way to update any chapter.
>
> Thing look clear in theory. However I cannot go on in practice. How to
> launch any test for micronumpy in interactive mode?
>
> I suppose it should be possible to import some modules from micronumpy
> using interactive mode of pypy.
> I check out branch release-4.0.x, then
> ~/work/pypy/pypy_src$ python pypy/bin/pyinteractive.py
> --allworkingmodules -c "import
> pypy.module.micronumpy.MultiArrayModule"
> I complains about signal module and fails.
> The same happens when I use python 2.7 and pypy 4.0.1 for launching
> pyinteractive. The same for module micronumpy.ctor.
> Whole output is here: https://gist.github.com/serge-m/d3f9f9863e15fc5c6af2
>
> What am I doing wrong?
>
> In general I want to run a test for micronumpy. Then make it
> debuggable to see how micronumpy works.
>
> I also tried to use pytest and test. I extracted a single test from
> pypy/pypy_src/pypy/module/micronumpy/test/test_selection.py into
> test_selection_2.py to make things faster.
> Output is here:
> https://gist.github.com/serge-m/3c51f35c702cc57b00c2
>
>
> On Sun, Jan 3, 2016 at 8:19 AM, Yury V. Zaytsev <yury at shurup.com> wrote:
>> On Sun, 2016-01-03 at 02:07 +0100, Sergey Matyunin wrote:
>>>
>>> -Compiling pypy for linux on takes about 1 hour, right?
>>
>> Something in this range, depending on your hardware.
>>
>>> -Does faster build mode exist? Probably with less optimizations
>>> (without -O3 etc.)
>>
>> As you might have already noticed, most of the time goes into
>> *translation* and not compilation itself. Unfortunately, translation is
>> still single-threaded, and therefore doesn't benefit from having more
>> cores. One thing that you definitively should do is to translate PyPy
>> with the latest version of PyPy instead of CPython, this makes a huge
>> difference. I think it is also still possible to disable gc to speed the
>> translation up a bit, but I'm not sure if this makes much sense (see
>> below).
>>
>>> -Is there way to rebuild only micronumpy?
>>> -How do developers usually debug modules such as micronumpy? I am
>>> curious about tools and techniques.
>>
>> PyPy has a interpreted mode, in which the interpreter is interpreted,
>> rather than translated and compiled. This mode is way too slow for
>> normal usage, but it's good enough to run most of the tests.
>>
>> The developers usually write tests for the functionality they want to
>> implement and make sure they fail, then implement it and make sure they
>> pass in the interpreted mode (without doing full translations between
>> the iterations). Only then they run a full translation or wait for a
>> nightly, and hopefully the tests still pass for the translated version
>> as well.
>>
>> P.S. As a side note, I found it curious and amusing that lots of people
>> are talking TDD, but apparently for a project of complexity and scale of
>> PyPy, there is simply no other practical way to do development,
>> irrespectively of whether you like it or not :-)
>>
>> P.P.S. Feel free to re-use my email for a FAQ and such, if something
>> along these lines isn't already in there...
>>
>> --
>> Sincerely yours,
>> Yury V. Zaytsev
>>
>>
>
>
>
> --
> Сергей
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> https://mail.python.org/mailman/listinfo/pypy-dev



-- 
Vincent Legoll


More information about the pypy-dev mailing list