[py-dev] py.test --exec

Maciek Fijalkowski fijal at genesilico.pl
Wed Oct 10 13:56:18 CEST 2007


Jacek Generowicz wrote:
>
> On 10 Oct 2007, at 07:58, Maciek Fijalkowski wrote:
>
>> Jacek Generowicz wrote:
>>> What sort of values of --exec should I expect to work/fail?
>>>
>> should expect python executable. I happily use --exec like
>> --exec=python2.4, --exec=pypy-c.
>
> Sure. It works just fine for me with standard Python interpreters, 
> just not the custom-build.
>
>> Another way to run it is to run py.test
>> under custom executable (we use this with pypy-c), like
>>
>> ~/nsim/pyfem3/pyfem3 py.test interface/nmag
>
> $ pyfem3/pyfem3 py/py/bin/py.test interface/nmag
> Traceback (most recent call last):
>   File "<string>", line 1, in ?
>   File "py/py/bin/py.test", line 3, in ?
>     from _findpy import py
> ImportError: No module named _findpy
>
> $ echo $PYTHONPATH
> /home/jacek/nsim/py
>
> This PYTHONPATH was set by eval `python nsim/py/py/env.py`.
>
> However, if I manually add /home/jacek/nsim/py/py/bin to the 
> PYTHONPATH, I get more success.
>
> Should env.py be adjusted to include py/py/bin in the PYTHONPATH ?
Well, that's another issue, also related to your custom interpreter. You 
should have py lib on path in order to run py.test. Whether it's done by 
symlinking it somewhere or by adding to PYTHONPATH, doesn't matter. You 
might also encounter the same when trying to run eg django on top of 
your python. You might trick site.py to include default python path 
(/usr/lib/python2.x/site-packages for example) in your custom 
interpreter to do that.
>
> Now I am left with interesting interactions between the namespace 
> magic in py.test and the namespace and command line parsing magic in 
> the custom-built Python, but I'll have to do quite a bit of poking 
> around to understand exactly what is going on.
pylib should be very careful about populating namespace. everything is 
under py.xxx, or py.__.xxx, so shouldn't be a problem. More mess is with 
builtin modules like code.py etc., make sure you have no such files in 
current directory, or available around.

Cheers,
fijal
>
> Anyway, your suggestion has got me quite a but further.
>
> Thanks.
You're welcome.
For quicker answers, go to #pylib on irc.freenode.net.

Cheers,
fijal


:.




More information about the Pytest-dev mailing list