Commit 1f1c247a authored by Steven Bethard's avatar Steven Bethard

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

parent 50be1ca5
No related merge requests found
...@@ -26,6 +26,13 @@ class TestCase(unittest.TestCase): ...@@ -26,6 +26,13 @@ class TestCase(unittest.TestCase):
print(obj2) print(obj2)
super(TestCase, self).assertEqual(obj1, 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): class TempDirMixin(object):
...@@ -1715,6 +1722,7 @@ class TestAddSubparsers(TestCase): ...@@ -1715,6 +1722,7 @@ class TestAddSubparsers(TestCase):
return parser return parser
def setUp(self): def setUp(self):
super().setUp()
self.parser = self._get_parser() self.parser = self._get_parser()
self.command_help_parser = self._get_parser(subparser_help=True) self.command_help_parser = self._get_parser(subparser_help=True)
...@@ -1942,6 +1950,7 @@ class TestParentParsers(TestCase): ...@@ -1942,6 +1950,7 @@ class TestParentParsers(TestCase):
self.assertRaises(ArgumentParserError, *args, **kwargs) self.assertRaises(ArgumentParserError, *args, **kwargs)
def setUp(self): def setUp(self):
super().setUp()
self.wxyz_parent = ErrorRaisingArgumentParser(add_help=False) self.wxyz_parent = ErrorRaisingArgumentParser(add_help=False)
self.wxyz_parent.add_argument('--w') self.wxyz_parent.add_argument('--w')
x_group = self.wxyz_parent.add_argument_group('x') x_group = self.wxyz_parent.add_argument_group('x')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment