Since I'm running the tests a lot now to prepare for the release, I wanted to 
make it a little easier to read. Attached is an "hg export" diff containing my 
changes. Can somebody import it or give me access? The changes are:

* Use ----- separaters between tests rather than in the middle. It used to 
separate the description from the interactive portion, which made it take an 
extra few moments to find where to read what you are supposed to be looking for.
* Indent the test's description, also to aid readability
* Indicate your progress through the test suite, e.g. (2/4) 

====== OLD output =========
% python tests/test.py image-png-load
------------------------------------------------------------------------------
Running Test: image.PYPNG_RGBA_LOAD
Test RGBA load using PyPNG.  You should see the rgba.png image on 
a checkboard background.

------------------------------------------------------------------------------
Press return to begin test...
Test RGBA load using PyPNG.  You should see the rgba.png image on 
a checkboard background.

[P]assed test, [F]ailed test: 
Running Test: image.PYPNG_RGB_LOAD
Test RGB load using PyPNG.  You should see the rgb.png image on 
a checkboard background.

------------------------------------------------------------------------------
...

======  NEW output =======
% python tests/test.py image-png-load
------------------------------------------------------------------------------
Running Test: image.PYPNG_RGBA_LOAD (1/4)

   Test RGBA load using PyPNG.  You should see the rgba.png image on 
   a checkboard background.

Press return to begin test...
[P]assed test, [F]ailed test: 
------------------------------------------------------------------------------
Running Test: image.PYPNG_RGB_LOAD (2/4)

   Test RGB load using PyPNG.  You should see the rgb.png image on 
   a checkboard background.

Press return to begin test...
^[[P]assed test, [F]ailed test: 
------------------------------------------------------------------------------
...

Winston Wolff
Stratolab - Games for Learning
tel: (917) 543 8852
web: www.stratolab.com

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

# HG changeset patch
# User Winston W <[email protected]>
# Date 1339790041 25200
# Node ID c39a8637b65d6a73c96aca1f2adafab0374fbdb6
# Parent  3bc7a0f501e98461084e4d1bc0f3fd159c46d73e
Make test runner output easier to read and verify for the tester.

diff -r 3bc7a0f501e9 -r c39a8637b65d tests/test.py
--- a/tests/test.py     Sat Mar 17 14:23:55 2012 -0500
+++ b/tests/test.py     Fri Jun 15 12:54:01 2012 -0700
@@ -234,10 +234,11 @@
         else:
             result = StandardTestResult(self)
 
-        print ("Running Test: %s" % self)
+        print '-' * 78
+        options.completed_tests += 1
+        print ("Running Test: %s (%d/%d)\n" % (self, options.completed_tests, 
options.num_tests))
         if module.__doc__:
-            print module.__doc__
-        print '-' * 78
+            print '    ' + module.__doc__.replace('\n','\n    ')
         if module_interactive:
             raw_input('Press return to begin test...')
 
@@ -257,7 +258,7 @@
         if (module_interactive and 
             len(result.failures) == 0 and 
             len(result.errors) == 0):
-            print module.__doc__
+#             print module.__doc__
             user_result = raw_input('[P]assed test, [F]ailed test: ')
             if user_result and user_result[0] in ('F', 'f'):
                 print 'Enter failure description: '
@@ -277,6 +278,9 @@
     def __cmp__(self, other):
         return cmp(str(self), str(other))
 
+    def num_tests(self):
+        return 1
+
 class TestSection(object):
     def __init__(self, name):
         self.name = name
@@ -293,6 +297,9 @@
     def __repr__(self):
         return 'TestSection(%s)' % self.name
 
+    def num_tests(self):
+        return sum([c.num_tests() for c in self.children])
+
 class TestPlan(TestSection):
     def __init__(self):
         self.root = None
@@ -516,7 +523,8 @@
         components = [plan.root]
 
     if not errors:
-        print '-' * 78
+        options.num_tests = sum([c.num_tests() for c in components])
+        options.completed_tests = 0
         for component in components:
             component.test(options)
         print '-' * 78

Reply via email to