[TIP] setlocale problem with tox but not with nosetests (repost)

Albert-Jan Roskam fomcl at yahoo.com
Wed May 27 01:27:27 PDT 2015


(Reposting for the second time as the original message does not appear to get through; is anyone else experiencing problems with getting messages/replies posted??)

----Forwarded message----
From: fomcl at yahoo.com
To: holger at merlinux.eu, stephan.obermann at gmail.com
Cc: testing-in-python at lists.idyll.org
Sent: Fri, May 22, 2015 4:02 PM CEST
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? I have the feeling that I am mixing the pre-version 2 and the version 2 approach here.
Also, setting the locale like this will not work on Windows, which does not care about LANG. I do not know the programmatical equivalent of changing the Regional Settings in the Control Panel (setlocale in libc?)

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

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

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

[testenv:win-french]
platform = win
setenv =
  LANG = "France.French.1252"
commands =
   nose []

* (etc, also for e.g. English locale, for each OS.)


Thanks again!

Albert-Jan



More information about the testing-in-python mailing list