[Python-checkins] r53423 - python/trunk/Lib/test/test_optparse.py

guido.van.rossum python-checkins at python.org
Sun Jan 14 04:46:34 CET 2007


Author: guido.van.rossum
Date: Sun Jan 14 04:46:33 2007
New Revision: 53423

Modified:
   python/trunk/Lib/test/test_optparse.py
Log:
Remove a dependency of this test on $COLUMNS.


Modified: python/trunk/Lib/test/test_optparse.py
==============================================================================
--- python/trunk/Lib/test/test_optparse.py	(original)
+++ python/trunk/Lib/test/test_optparse.py	Sun Jan 14 04:46:33 2007
@@ -1500,8 +1500,16 @@
         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.


More information about the Python-checkins mailing list