[Python-checkins] r86080 - python/branches/py3k/Lib/test/test_argparse.py

steven.bethard python-checkins at python.org
Mon Nov 1 14:56:09 CET 2010


Author: steven.bethard
Date: Mon Nov  1 14:56:09 2010
New Revision: 86080

Log:
Unset COLUMNS for test_argparse (and restore afterwards) (issue 9553)

Modified:
   python/branches/py3k/Lib/test/test_argparse.py

Modified: python/branches/py3k/Lib/test/test_argparse.py
==============================================================================
--- python/branches/py3k/Lib/test/test_argparse.py	(original)
+++ python/branches/py3k/Lib/test/test_argparse.py	Mon Nov  1 14:56:09 2010
@@ -26,6 +26,13 @@
             print(obj2)
         super(TestCase, self).assertEqual(obj1, obj2)
 
+    def setUp(self):
+        # The tests assume that line wrapping occurs at 80 columns, but this
+        # behaviour can be overridden by setting the COLUMNS environment
+        # variable.  To ensure that this assumption is true, unset COLUMNS.
+        env = support.EnvironmentVarGuard()
+        env.unset("COLUMNS")
+        self.addCleanup(env.__exit__)
 
 
 class TempDirMixin(object):
@@ -1715,6 +1722,7 @@
         return parser
 
     def setUp(self):
+        super().setUp()
         self.parser = self._get_parser()
         self.command_help_parser = self._get_parser(subparser_help=True)
 
@@ -1942,6 +1950,7 @@
         self.assertRaises(ArgumentParserError, *args, **kwargs)
 
     def setUp(self):
+        super().setUp()
         self.wxyz_parent = ErrorRaisingArgumentParser(add_help=False)
         self.wxyz_parent.add_argument('--w')
         x_group = self.wxyz_parent.add_argument_group('x')


More information about the Python-checkins mailing list