From 0567ba20f3a9f43c105ad91d8a19f23d7640fac3 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sun, 14 Jan 2007 03:46:33 +0000 Subject: [PATCH] Remove a dependency of this test on $COLUMNS. --- Lib/test/test_optparse.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py index 4582fa7ae82..9b52659b1fa 100644 --- a/Lib/test/test_optparse.py +++ b/Lib/test/test_optparse.py @@ -1500,8 +1500,16 @@ class TestHelp(BaseTest): self.assertHelpEquals(_expected_help_long_opts_first) def test_help_title_formatter(self): - self.parser.formatter = TitledHelpFormatter() - self.assertHelpEquals(_expected_help_title_formatter) + save = os.environ.get("COLUMNS") + try: + os.environ["COLUMNS"] = "80" + self.parser.formatter = TitledHelpFormatter() + self.assertHelpEquals(_expected_help_title_formatter) + finally: + if save is not None: + os.environ["COLUMNS"] = save + else: + del os.environ["COLUMNS"] def test_wrap_columns(self): # Ensure that wrapping respects $COLUMNS environment variable.