diff options
author | Steven Bethard <steven.bethard@gmail.com> | 2010-11-01 13:56:09 (GMT) |
---|---|---|
committer | Steven Bethard <steven.bethard@gmail.com> | 2010-11-01 13:56:09 (GMT) |
commit | 1f1c247adb974fe7f6ed0fa106884a95d031d622 (patch) | |
tree | 0e4eee569a59b0a875f5a172c922795af88bd52b /Lib | |
parent | 50be1ca55ef5d27d6e300b426c870e3a79faf13f (diff) | |
download | cpython-1f1c247adb974fe7f6ed0fa106884a95d031d622.zip cpython-1f1c247adb974fe7f6ed0fa106884a95d031d622.tar.gz cpython-1f1c247adb974fe7f6ed0fa106884a95d031d622.tar.bz2 |
Unset COLUMNS for test_argparse (and restore afterwards) (issue 9553)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_argparse.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index f01c65f..08dd91b 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -26,6 +26,13 @@ class TestCase(unittest.TestCase): 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 @@ class TestAddSubparsers(TestCase): 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 @@ class TestParentParsers(TestCase): 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') |