[pypy-commit] pypy py3k: rewrite this test by using sum() instead of print(). The problem with print is that we are also tracing a lot of functions inside encodings/utf_8.py, and this adds noise to the test

antocuni noreply at buildbot.pypy.org
Tue Feb 21 10:50:38 CET 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52703:45dc6af4adc3
Date: 2012-02-21 00:01 +0100
http://bitbucket.org/pypy/pypy/changeset/45dc6af4adc3/

Log:	rewrite this test by using sum() instead of print(). The problem
	with print is that we are also tracing a lot of functions inside
	encodings/utf_8.py, and this adds noise to the test

diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py
--- a/pypy/interpreter/test/test_pyframe.py
+++ b/pypy/interpreter/test/test_pyframe.py
@@ -1,12 +1,9 @@
-from pypy.tool import udir
 from pypy.conftest import option
 
 
 class AppTestPyFrame:
 
     def setup_class(cls):
-        cls.w_udir = cls.space.wrap(str(udir.udir))
-        cls.w_tempfile1 = cls.space.wrap(str(udir.udir.join('tempfile1')))
         if not option.runappdirect:
             w_call_further = cls.space.appexec([], """():
                 def call_further(f):
@@ -260,7 +257,7 @@
         assert l[0][1] == 'call'
         assert res == 'hidden' # sanity
 
-    def test_trace_hidden_prints(self):
+    def test_trace_hidden_applevel_builtins(self):
         import sys
 
         l = []
@@ -268,19 +265,17 @@
             l.append((a,b,c))
             return trace
 
-        outputf = open(self.tempfile1, 'w')
         def f():
-            print >> outputf, 1
-            print >> outputf, 2
-            print >> outputf, 3
+            sum([])
+            sum([])
+            sum([])
             return "that's the return value"
 
         sys.settrace(trace)
         f()
         sys.settrace(None)
-        outputf.close()
         # should get 1 "call", 3 "line" and 1 "return" events, and no call
-        # or return for the internal app-level implementation of 'print'
+        # or return for the internal app-level implementation of sum
         assert len(l) == 6
         assert [what for (frame, what, arg) in l] == [
             'call', 'line', 'line', 'line', 'line', 'return']


More information about the pypy-commit mailing list