[Zope3-checkins] SVN: Zope3/trunk/ Fixed a crash in the test runner when the curses module is available, but it

Marius Gedminas marius at pov.lt
Mon Sep 26 10:17:41 EDT 2005


Log message for revision 38639:
  Fixed a crash in the test runner when the curses module is available, but it
  cannot find the terminfo database to determine the screen width.
  
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/testing/test.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2005-09-26 13:35:01 UTC (rev 38638)
+++ Zope3/trunk/doc/CHANGES.txt	2005-09-26 14:17:41 UTC (rev 38639)
@@ -65,9 +65,13 @@
         Tales expression ``pagelet:`` we raise a Unauthorized exception if
         the permission isn't right.
 
+      - Fixed a crash in the test runner when the curses module is available,
+        but it cannot find the terminfo database to determine the screen
+        width.
+
     Much thanks to everyone who contributed to this release:
 
-      Stephan Richter, Roger Ineichen
+      Stephan Richter, Roger Ineichen, Marius Gedminas
 
     Note: If you are not listed and contributed, please add yourself. This
           note will be deleted before the release.

Modified: Zope3/trunk/src/zope/app/testing/test.py
===================================================================
--- Zope3/trunk/src/zope/app/testing/test.py	2005-09-26 13:35:01 UTC (rev 38638)
+++ Zope3/trunk/src/zope/app/testing/test.py	2005-09-26 14:17:41 UTC (rev 38639)
@@ -276,8 +276,13 @@
             except ImportError:
                 pass
             else:
-                curses.setupterm()
-                self._maxWidth = curses.tigetnum('cols')
+                try:
+                    curses.setupterm()
+                    cols = curses.tigetnum('cols')
+                    if cols > 0:
+                        self._maxWidth = cols
+                except curses.error:
+                    pass
             self._maxWidth -= len("xxxx/xxxx (xxx.x%): ") + 1
 
     def stopTest(self, test):



More information about the Zope3-Checkins mailing list