[Zope3-checkins] SVN: zope.testing/branches/output-refactoring/src/zope/testing/testrunner.py Always compute self.max_width.

Marius Gedminas marius at pov.lt
Fri Jul 13 07:04:58 EDT 2007


Log message for revision 77846:
  Always compute self.max_width.
  
  Prioritize TODO comments I've added recently.
  
  

Changed:
  U   zope.testing/branches/output-refactoring/src/zope/testing/testrunner.py

-=-
Modified: zope.testing/branches/output-refactoring/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/branches/output-refactoring/src/zope/testing/testrunner.py	2007-07-13 11:01:36 UTC (rev 77845)
+++ zope.testing/branches/output-refactoring/src/zope/testing/testrunner.py	2007-07-13 11:04:58 UTC (rev 77846)
@@ -279,20 +279,19 @@
 
     def compute_max_width(self):
         """Try to determine the terminal width."""
-        if self.progress: # XXX: mgedmin: why not do this always?
+        try:
+            # Note that doing this every time is more test friendly.
+            import curses
+        except ImportError:
+            # avoid reimporting a broken module in python 2.3
+            sys.modules['curses'] = None
+        else:
             try:
-                # Note that doing this every time is more test friendly.
-                import curses
-            except ImportError:
-                # avoid reimporting a broken module in python 2.3
-                sys.modules['curses'] = None
+                curses.setupterm()
+            except TypeError:
+                pass
             else:
-                try:
-                    curses.setupterm()
-                except TypeError:
-                    pass
-                else:
-                    self.max_width = curses.tigetnum('cols')
+                self.max_width = curses.tigetnum('cols')
 
     def getShortDescription(self, test, room):
         """Return a description of a test that fits in ``room`` characters."""
@@ -899,7 +898,7 @@
 
             prev = rc
             rc = sys.gettotalrefcount()
-            # TODO: move the output into OutputFormatter
+            # TODO LATER: move the output into OutputFormatter
             if options.verbose:
                 track.update()
                 if i:
@@ -1119,7 +1118,7 @@
         self.testTearDown()
         self.options.output.stop_test(test)
 
-        # TODO: figure out how to move this to OutputFormatter
+        # TODO NOW PERHAPS: figure out how to move this to OutputFormatter
         if gc.garbage:
             print "The following test left garbage:"
             print test
@@ -1141,7 +1140,7 @@
 class FakeInputContinueGenerator:
 
     def readline(self):
-        # TODO: figure out how to move this to OutputFormatter
+        # TODO LATER: figure out how to move this to OutputFormatter
         print  'c\n'
         print '*'*70
         print ("Can't use pdb.set_trace when running a layer"
@@ -1573,7 +1572,7 @@
 
 
     def output(self):
-        # TODO: figure out how to move this to OutputFormatter        
+        # TODO LATER: figure out how to move this to OutputFormatter        
         printed = False
         s1 = s2 = 0
         for t, delta1, delta2 in self.delta:



More information about the Zope3-Checkins mailing list