[TIP] setlocale problem with tox but not with nosetests

Albert-Jan Roskam fomcl at yahoo.com
Thu May 21 13:41:39 PDT 2015


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?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 



More information about the testing-in-python mailing list