[issue9553] test_argparse.py: 80 failures if COLUMNS env var set to a value other than 80

Denver Coneybeare report at bugs.python.org
Wed Aug 11 05:18:24 CEST 2010


Denver Coneybeare <denver.coneybeare at gmail.com> added the comment:

That is a very good point, bethard, that setting os.environ["COLUMNS"] in my suggested patch (test_argparse.py.COLUMNS.patch) is global and should be test-local.  I've attached an updated patch (test_argparse.py.COLUMNS.update1.patch) which uses setUp() and tearDown() to prepare and restore the COLUMNS environment variable.  The one difference from my previous patch is that instead of setting the COLUMNS environment variable to 80 I just unset it.

I also considered EnvironmentVarGuard, as suggested by r.david.murray, but I'm not sure it's designed for global setting of environment variables.  EnvironmentVarGuard appears to have been designed to be used as a context manager for an individual test, but the COLUMNS environment variable needs to be adjusted for *every* test.

----------
Added file: http://bugs.python.org/file18473/test_argparse.py.COLUMNS.update1.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9553>
_______________________________________


More information about the Python-bugs-list mailing list