[py-dev] adding env option to xspec (initialy posted to [execnet-dev])

Jakub Gustak jgustak at gmail.com
Fri Jun 25 17:05:01 CEST 2010


On Fri, Jun 25, 2010 at 3:41 PM, holger krekel <holger at merlinux.eu> wrote:
> Hi Jakub,
>
> On Fri, Jun 25, 2010 at 15:10 +0100, Jakub Gustak wrote:
>> > 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 ...
>> ...
>> 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?
>
> I think this is bearable as xspecs have very few key-value pairs.
> You could use env[4:] instead of lstrip() to optimize though :)
>
> One other bit: could you try to rework your patch so that it transfers
> the environment variables in the "slaveinput" dictionary?
> This is also processable from pytest_configure and produces a
> smaller patch i guess.

Can you explain in more details?

Passing in the slaveinput is not a problem, but where you would like
the environ be updated exactly?

jakub



More information about the Pytest-dev mailing list