[TIP] setlocale problem with tox but not with nosetests

Stephan Obermann stephan.obermann at gmail.com
Thu May 21 15:10:28 PDT 2015


On Thu, May 21, 2015 at 11:42 PM, holger krekel <holger at merlinux.eu> wrote:

> 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.
>
> moreover, we could think about recognizing a TOX_PASSENV variable
> and add the specified names into all passenv settings for the testenvs.
> Would that help in your case?
>

​Yes, that would definitely help to keep maintenance effort for our
existing packages low - so much appreciated. :-)
Would this also work for generated test environments (
https://testrun.org/tox/latest/config.html#generating-environments-conditional-settings)?
​

​Cheers,

/stephan​



holger
>
> > best,
> > holger
> >
> > > 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
> > > >
> >
> > > _______________________________________________
> > > testing-in-python mailing list
> > > testing-in-python at lists.idyll.org
> > > http://lists.idyll.org/listinfo/testing-in-python
> >
> >
> > --
> > about me:    http://holgerkrekel.net/about-me/
> > contracting: http://merlinux.eu
>
> --
> about me:    http://holgerkrekel.net/about-me/
> contracting: http://merlinux.eu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20150522/08f76c85/attachment-0001.htm>


More information about the testing-in-python mailing list