[pypy-svn] r77935 - pypy/branch/jitffi/pypy/jit/metainterp/test

antocuni at codespeak.net antocuni at codespeak.net
Thu Oct 14 15:47:30 CEST 2010


Author: antocuni
Date: Thu Oct 14 15:47:29 2010
New Revision: 77935

Modified:
   pypy/branch/jitffi/pypy/jit/metainterp/test/test_optimizeopt.py
Log:
try to use the full terminal width when displaying the oplists side-by-side 


Modified: pypy/branch/jitffi/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/metainterp/test/test_optimizeopt.py	(original)
+++ pypy/branch/jitffi/pypy/jit/metainterp/test/test_optimizeopt.py	Thu Oct 14 15:47:29 2010
@@ -132,14 +132,20 @@
 # ____________________________________________________________
 
 def equaloplists(oplist1, oplist2, strict_fail_args=True, remap={}):
-    print '-'*20, 'Comparing lists', '-'*20
+    # try to use the full width of the terminal to display the list
+    # unfortunately, does not work with the default capture method of py.test
+    # (which is fd), you you need to use either -s or --capture=sys, else you
+    # get the standard 80 columns width
+    totwidth = py.io.get_terminal_width()
+    width = totwidth / 2 - 1
+    print ' Comparing lists '.center(totwidth, '-')
     for op1, op2 in zip(oplist1, oplist2):
         txt1 = str(op1)
         txt2 = str(op2)
         while txt1 or txt2:
-            print '%-39s| %s' % (txt1[:39], txt2[:39])
-            txt1 = txt1[39:]
-            txt2 = txt2[39:]
+            print '%s| %s' % (txt1[:width].ljust(width), txt2[:width])
+            txt1 = txt1[width:]
+            txt2 = txt2[width:]
         assert op1.getopnum() == op2.getopnum()
         assert op1.numargs() == op2.numargs()
         for i in range(op1.numargs()):



More information about the Pypy-commit mailing list