[TIP] setlocale problem with tox but not with nosetests

Stephan Obermann stephan.obermann at gmail.com
Thu May 21 14:23:55 PDT 2015


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
)?

On 05/21/2015 10:41 PM, Albert-Jan Roskam wrote:
> > Hi,
> >
> > I am using Tox to run my unittests. This morning I upgraded my system
> (dist-upgrade to Debian 8 64), and I also upgraded tox (version 2.0.1),
> nosetests
> > (version 1.3.6) and virtualenv (version 12.1.1).
> >
> > Now a setlocale line in my code trows an error. This happens in tox
> (py27 and py33+) but not in nosetests. The (very simplified) code is given
> below. Any idea why this happens, and how to resolve this?
> >
> >
> > import locale
> > class Foo(object):
> >
> >     def __init__(self):
> >
> >         print("@@@@@")
> >         print(locale.setlocale(locale.LC_ALL, ""))
> >                print("@@@@@")
> >
> >
> > import unittest
> >
> > class TestFoo(unittest.TestCase):
> >     def test_foo(self):
> >         self.assertTrue(True)
> >
> > if __name__ == "__main__":
> >        unittest.main()
> >
> >
> > File
> "/home/albertjan/nfs/Public/project/.tox/py27/lib/python2.7/locale.py",
> line 579, in setlocale
> > return _setlocale(category, locale)
> > Error: unsupported locale setting
> >
> > -------------------- >> begin captured stdout << ---------------------
> > @@@@@
> >
> > --------------------- >> end captured stdout << ----------------------
> >
> > Thanks!
> >
> > Regards,
> >
> > Albert-Jan
> >
> >
> >
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > All right, but apart from the sanitation, the medicine, education, wine,
> public order, irrigation, roads, a
> >
> > fresh water system, and public health, what have the Romans ever done
> for us?
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > _______________________________________________
> > testing-in-python mailing list
> > testing-in-python at lists.idyll.org
> > http://lists.idyll.org/listinfo/testing-in-python
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20150521/f6d87853/attachment.htm>


More information about the testing-in-python mailing list