[pypy-svn] r11526 - in pypy/dist/lib-python-2.3.4/test: . result

arigo at codespeak.net arigo at codespeak.net
Wed Apr 27 17:33:17 CEST 2005


Author: arigo
Date: Wed Apr 27 17:33:17 2005
New Revision: 11526

Modified:
   pypy/dist/lib-python-2.3.4/test/conftest.py
   pypy/dist/lib-python-2.3.4/test/result/quickreport.py
Log:
- write an OK or FAILED at the end of the .txt files associated with output 
  tests.

- improved quickreport.py.  It tries to categorize the results in Ok, ERR,
  or blank if it looks like an expected failure, or T/O for time-out.



Modified: pypy/dist/lib-python-2.3.4/test/conftest.py
==============================================================================
--- pypy/dist/lib-python-2.3.4/test/conftest.py	(original)
+++ pypy/dist/lib-python-2.3.4/test/conftest.py	Wed Apr 27 17:33:17 2005
@@ -847,20 +847,25 @@
         else:
             status = 'abnormal termination 0x%x' % status
 
+        failure = None
         resultfile = resultfilename.open('a')
-        print >> resultfile, '='*26, 'closed', '='*26
-        print >> resultfile, 'execution time:', time.time() - starttime, 'seconds'
-        print >> resultfile, 'exit status:', status
-        resultfile.close()
-        if status != 0:
-            time.sleep(0.5)   # time for a Ctrl-C to reach us :-)
-        #print output 
-        assert status == 0, "exitstatus is %d" %(status,)
-
         if outputfilename:
             expectedfilename = mydir.join('output', self.fspath.purebasename)
             expected = expectedfilename.read(mode='r')
             result = outputfilename.read(mode='r')
             if result != expected: 
                 reportdiff(expected, result) 
-                py.test.fail("output check failed: %s" % (self.fspath.basename,))
+                failure = "output check failed: %s" % (self.fspath.basename,)
+                print >> resultfile, 'FAILED: test output differs'
+            else:
+                print >> resultfile, 'OK'
+        print >> resultfile, '='*26, 'closed', '='*26
+        print >> resultfile, 'execution time:', time.time() - starttime, 'seconds'
+        print >> resultfile, 'exit status:', status
+        resultfile.close()
+        if status != 0:
+            failure = "exitstatus is %d" %(status,)
+        #print output 
+        if failure:
+             time.sleep(0.5)   # time for a Ctrl-C to reach us :-)
+             py.test.fail(failure)

Modified: pypy/dist/lib-python-2.3.4/test/result/quickreport.py
==============================================================================
--- pypy/dist/lib-python-2.3.4/test/result/quickreport.py	(original)
+++ pypy/dist/lib-python-2.3.4/test/result/quickreport.py	Wed Apr 27 17:33:17 2005
@@ -1,3 +1,5 @@
+#! /usr/bin/env python
+
 import sys; sys.path.insert(0, '../../..')
 import py, re
 
@@ -11,7 +13,27 @@
 r_timeout = re.compile(r"""==========================timeout==========================
 """)
 
+r_importerror = re.compile(r"ImportError: (\w+)")
+
+# Linux list below.  May need to add a few ones for Windows...
+IGNORE_MODULES = """
+    array          datetime       md5          regex     _testcapi
+    audioop        dbm            mmap         resource  time
+    binascii       dl             mpz          rgbimg    timing
+    _bsddb         fcntl          nis          rotor     _tkinter
+    bz2            gdbm           operator     select    unicodedata
+    cmath          grp            ossaudiodev  sha       _weakref
+    cPickle        _hotshot       parser       _socket   xreadlines
+    crypt          imageop        pcre         _ssl      zlib
+    cStringIO      itertools      pwd          strop
+    _csv           linuxaudiodev  pyexpat      struct
+    _curses_panel  _locale        _random      syslog
+    _curses        math           readline     termios
+""".split()
+
+
 class Result:
+    pts = '?'
     name = '?'
     exit_status = '?'
     execution_time = '?'
@@ -21,20 +43,45 @@
     def read(self, fn):
         self.name = fn.purebasename
         data = fn.read(mode='r')
+        self.timeout = bool(r_timeout.search(data))
         match = r_end.search(data)
         assert match
-        self.finalline = match.group(1)
         self.execution_time = float(match.group(2))
         self.exit_status = match.group(3)
-        self.timeout = bool(r_timeout.match(data))
+        if self.exit_status == '0':
+            self.pts = 'Ok'
+        elif not self.timeout:
+            self.finalline = match.group(1)
+            self.pts = 'ERR'
+            match1 = r_importerror.match(self.finalline)
+            if match1:
+                module = match1.group(1)
+                if module in IGNORE_MODULES:
+                    self.pts = ''   # doesn't count in our total
+            elif self.finalline.startswith('TestSkipped: '):
+                self.pts = ''
+        else:
+            self.finalline = 'TIME OUT'
+            self.pts = 'T/O'
 
     def __str__(self):
-        return '%-17s %3s  %5s  %s' % (
+        return '%-3s %-17s %3s  %5s  %s' % (
+            self.pts,
             self.name,
             self.exit_status,
-            self.timeout and 'timeout' or str(self.execution_time)[:5],
+            str(self.execution_time)[:5],
             self.finalline)
 
+header = Result()
+header.pts = 'res'
+header.name = 'name'
+header.exit_status = 'err'
+header.execution_time = 'time'
+header.finalline = '  last output line'
+print
+print header
+print
+
 
 files = mydir.listdir("*.txt")
 files.sort()
@@ -45,3 +92,5 @@
     except AssertionError:
         pass
     print result
+
+print



More information about the Pypy-commit mailing list