[TIP] setlocale problem with tox but not with nosetests

Ronny Pfannschmidt opensource at ronnypfannschmidt.de
Thu May 21 13:48:34 PDT 2015


tox 2.0 introduced env var isolation, you need to explicitly white-list
or use a older version

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




More information about the testing-in-python mailing list