summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_optparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_optparse.py')
-rw-r--r--Lib/test/test_optparse.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_optparse.py b/Lib/test/test_optparse.py
index aa6525e..e05fbc6 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.