[TIP] setlocale problem with tox but not with nosetests

Albert-Jan Roskam fomcl at yahoo.com
Fri May 22 07:02:30 PDT 2015



----- Original Message -----

> From: holger krekel <holger at merlinux.eu>
> To: Stephan Obermann <stephan.obermann at gmail.com>
> Cc: Tip Python <testing-in-python at lists.idyll.org>
> Sent: Thursday, May 21, 2015 11:42 PM
> Subject: Re: [TIP] setlocale problem with tox but not with nosetests
> 
> On Thu, May 21, 2015 at 21:41 +0000, holger krekel wrote:
>>  On Thu, May 21, 2015 at 23:23 +0200, Stephan Obermann wrote:
>>  > On Thu, May 21, 2015 at 10:48 PM, Ronny Pfannschmidt <
>>  > opensource at ronnypfannschmidt.de> wrote:
>>  > 
>>  > > tox 2.0 introduced env var isolation, you need to explicitly 
> white-list
>>  > > or use a older version
>>  > >
>>  > 
>>  > ​Is there a way to disable this feature or white-list all environment
>>  > variables without specifying them one by one (as described in the
>>  > documentation
>>  > 
> https://testrun.org/tox/latest/example/basic.html#passing-down-environment-variables
>>  > )?
>> 
>>  You can use wildcards so for example
>> 
>>      passenv = *
>> 
>>  should work.  For tox-2.0.2 i plan to collect suggestions
>>  to see which env vars should be put into the default set.


Hi all,

Thanks a lot. Specifying passenv=LANG did the trick (although I thought it'd be LC_ALL). 


Related to this: What is the recommended way to run tox in various locales? I've read 
https://tox.readthedocs.org/en/latest/config-v2.htm, but it is still not entirely clear to me. I would like to follow the 'new' v2 approach, of course. 

Should tox.ini look something like this?


[tox]
envlist = {py27,py33,py34,pypy}-{win,posix}-{english,french}, docs

[testenv]
deps = nose, numpy
commands = nose []

[testenv:posix]
platform = linux|darwin
#setenv = 
#    LANG = "fr_FR.UTF-8"
commands = 

    french: set LANG="fr_FR.UTF-8" && nose []
       english: set LANG="en_US.UTF-8" && nose []
[testenv:win]
platform = win
#setenv = 
#    LANG = "french"
commands = 

    french: setx LANG "french" && nose []

       french: setx LANG "english" && nose []

Not even sure what the LANG equivalent in Windows is. I have tried setting it, but it does not seem to work in windows.

Thanks again!

Albert-Jan



More information about the testing-in-python mailing list