[pypy-svn] r77056 - pypy/branch/fast-forward/lib-python

afa at codespeak.net afa at codespeak.net
Tue Sep 14 10:17:12 CEST 2010


Author: afa
Date: Tue Sep 14 10:17:11 2010
New Revision: 77056

Modified:
   pypy/branch/fast-forward/lib-python/conftest.py
Log:
cpython 2.7 tests have no output directory.


Modified: pypy/branch/fast-forward/lib-python/conftest.py
==============================================================================
--- pypy/branch/fast-forward/lib-python/conftest.py	(original)
+++ pypy/branch/fast-forward/lib-python/conftest.py	Tue Sep 14 10:17:11 2010
@@ -86,27 +86,7 @@
         fn = regrtestdir.join(self.basename)
         return fn 
 
-    def getoutputpath(self): 
-        p = modregrtestdir.join('output', self.basename).new(ext='')
-        if p.check(file=1):
-            return p
-        p = regrtestdir.join('output', self.basename).new(ext='')
-        if p.check(file=1): 
-            return p 
-
-    def _prepare(self, space): 
-        # output tests sometimes depend on not running in
-        # verbose mode 
-        if not hasattr(self, '_prepared'): 
-            if self.getoutputpath(): 
-                space.appexec([], """(): 
-                    from test import test_support
-                    test_support.verbose = False
-            """)
-            self._prepared = True
-            
     def run_file(self, space): 
-        self._prepare(space)
         fspath = self.getfspath()
         assert fspath.check()
         modname = fspath.purebasename 
@@ -632,14 +612,8 @@
         regr_script = pypydir.join('tool', 'pytest', 
                                    'run-script', 'regrverbose.py')
         
-        # we use the regrverbose script to run the test, but don't get
-        # confused: it still doesn't set verbose to True by default if
-        # regrtest.outputpath() is true, because output tests get confused
-        # in verbose mode.  You can always force verbose mode by passing
-        # the -v option to py.test.  The regrverbose script contains the
-        # logic that CPython uses in its regrtest.py.
         regrrun = str(regr_script)
-        if not regrtest.getoutputpath() or pypy_option.verbose:
+        if pypy_option.verbose:
             regrrun_verbosity = '1'
         else:
             regrrun_verbosity = '0'
@@ -735,20 +709,10 @@
         if test_stderr.rfind(26*"=" + "skipped" + 26*"=") != -1:
             skipped = True
         outcome = 'OK'
-        expectedpath = regrtest.getoutputpath()
         if not exit_status: 
-            if expectedpath is not None: 
-                expected = expectedpath.read(mode='rU')
-                test_stdout = "%s\n%s" % (self.fspath.purebasename, test_stdout)     
-                if test_stdout != expected: 
-                    exit_status = 2  
-                    res, out, err = py.io.StdCapture.call(reportdiff, expected, test_stdout)
-                    outcome = 'ERROUT' 
-                    test_stderr += ("-" * 80 + "\n") + out
-            else:
-                if 'FAIL' in test_stdout or re.search('[^:]ERROR', test_stderr):
-                    outcome = 'FAIL'
-                    exit_status = 2  
+            if 'FAIL' in test_stdout or re.search('[^:]ERROR', test_stderr):
+                outcome = 'FAIL'
+                exit_status = 2  
         elif timedout: 
             outcome = "T/O"    
         else: 
@@ -763,49 +727,6 @@
             lst.append('core')
         return lst
 
-# test.regrtest.reportdiff was deleted in CPython2.6
-def reportdiff(expected, output):
-    import difflib
-    print "*" * 70
-    a = expected.splitlines(1)
-    b = output.splitlines(1)
-    sm = difflib.SequenceMatcher(a=a, b=b)
-    tuples = sm.get_opcodes()
-
-    def pair(x0, x1):
-        # x0:x1 are 0-based slice indices; convert to 1-based line indices.
-        x0 += 1
-        if x0 >= x1:
-            return "line " + str(x0)
-        else:
-            return "lines %d-%d" % (x0, x1)
-
-    for op, a0, a1, b0, b1 in tuples:
-        if op == 'equal':
-            pass
-
-        elif op == 'delete':
-            print "***", pair(a0, a1), "of expected output missing:"
-            for line in a[a0:a1]:
-                print "-", line,
-
-        elif op == 'replace':
-            print "*** mismatch between", pair(a0, a1), "of expected", \
-                  "output and", pair(b0, b1), "of actual output:"
-            for line in difflib.ndiff(a[a0:a1], b[b0:b1]):
-                print line,
-
-        elif op == 'insert':
-            print "***", pair(b0, b1), "of actual output doesn't appear", \
-                  "in expected output after line", str(a1)+":"
-            for line in b[b0:b1]:
-                print "+", line,
-
-        else:
-            print "get_opcodes() returned bad tuple?!?!", (op, a0, a1, b0, b1)
-
-    print "*" * 70
-
 #
 # Sanity check  (could be done more nicely too)
 #



More information about the Pypy-commit mailing list