> Hi Jakub,
>
> not sure it makes sense to add this to execnet, maybe better
> to xdist code?  Things is it's easy to set environment variables
> when initializing gateways yourself. Just when using pytest-xdist
> you cannot easily do this because that API level is not exposed.
> So xdist could grow a configuration option to interpret
> some additional xspec settings.
>
> I suggest to use
>
>    popen//env:NAME=value
>
> as syntax.   That being said i am not totally opposed to adding
> it directly to execnet.  Maybe other people here on the list also
> have comments ...
>
> best,
> holger
>
> On Thu, Jun 24, 2010 at 13:30 +0100, Jakub Gustak wrote:
>> Hello,
>>
>> I need to specify some ENV variable when running a sub-process (this
>> case for xdist). AFAIK there is no support for such feature.
>>
>> I do a workaround by popen//python=./python_with_env where
>> ./python_with_env does specify required ENV.
>>
>> It would be nice to have xspec env option (e.g. popen//env='VAR1=value
>> VAR2=value' ).
>>
>> I can fry up a patch for this functionality if you consider it a
>> feature worth inclusion.
>>
>> Cheers,
>> Jakub Gustak

Moving this topic to py-dev list in this case.

I prepared a patch, please review.

What I don't like about it is using XSspec.__dict__ because
env:NAME=VALUE requires a iteration through XSpec attributes:

+    def env(self):
+        return [(env.lstrip('env:'), value)
+                    for env, value in  self.gateway.spec.__dict__.iteritems()
+                    if env.startswith('env:')]

I believe a small extension to XSpec API would be nice. Any other ideas?

regards,
jakub

Attachment: env_xspec.patch
Description: Binary data

_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to