[pypy-svn] r67427 - in pypy/trunk/pypy: config doc/config interpreter/test module/_testing

pedronis at codespeak.net pedronis at codespeak.net
Wed Sep 2 13:27:07 CEST 2009


Author: pedronis
Date: Wed Sep  2 13:27:04 2009
New Revision: 67427

Added:
   pypy/trunk/pypy/doc/config/objspace.usemodules._testing.txt   (contents, props changed)
   pypy/trunk/pypy/module/_testing/
   pypy/trunk/pypy/module/_testing/__init__.py   (contents, props changed)
   pypy/trunk/pypy/module/_testing/app_notrpython.py   (contents, props changed)
Modified:
   pypy/trunk/pypy/config/pypyoption.py
   pypy/trunk/pypy/interpreter/test/test_pyframe.py
Log:
(micke, pedronis)

rewrite the hidden frame test to be less fragile at the price of introducing a testing only module, cpython
has those too, such is life



Modified: pypy/trunk/pypy/config/pypyoption.py
==============================================================================
--- pypy/trunk/pypy/config/pypyoption.py	(original)
+++ pypy/trunk/pypy/config/pypyoption.py	Wed Sep  2 13:27:04 2009
@@ -18,7 +18,8 @@
 default_modules.update(dict.fromkeys(
     ["_codecs", "gc", "_weakref", "marshal", "errno",
      "math", "_sre", "_pickle_support", "operator",
-     "parser", "symbol", "token", "_ast", "_random", "__pypy__"]))
+     "parser", "symbol", "token", "_ast", "_random", "__pypy__",
+     "_testing"]))
 
 
 # --allworkingmodules

Added: pypy/trunk/pypy/doc/config/objspace.usemodules._testing.txt
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/doc/config/objspace.usemodules._testing.txt	Wed Sep  2 13:27:04 2009
@@ -0,0 +1,3 @@
+Use the '_testing' module. This module exists only for PyPy own testing purposes.
+ 
+This module is expected to be working and is included by default.

Modified: pypy/trunk/pypy/interpreter/test/test_pyframe.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_pyframe.py	(original)
+++ pypy/trunk/pypy/interpreter/test/test_pyframe.py	Wed Sep  2 13:27:04 2009
@@ -140,20 +140,25 @@
         assert len(l) == 1
         assert isinstance(l[0][1], Exception)
 
-    def test_trace_print_hidden(self):
+    def test_trace_ignore_hidden(self):
         import sys
+        import _testing
+            
         l = []
         def trace(a,b,c):
             l.append((a,b,c))
 
         def f():
-            print 'foo!'
+            h = _testing.Hidden()
+            r = h.meth()
+            return r
 
         sys.settrace(trace)
-        f()
+        res = f()
         sys.settrace(None)
         assert len(l) == 1
         assert l[0][1] == 'call'
+        assert res == 'hidden' # sanity
 
     def test_trace_return_exc(self):
         import sys

Added: pypy/trunk/pypy/module/_testing/__init__.py
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/module/_testing/__init__.py	Wed Sep  2 13:27:04 2009
@@ -0,0 +1,17 @@
+
+"""
+Mixed-module definition for pypy own testing purposes
+"""
+
+from pypy.interpreter.mixedmodule import MixedModule
+
+
+class Module(MixedModule):
+    """PyPy own testing"""
+
+    interpleveldefs = {
+        }
+
+    appleveldefs = {
+        'Hidden': 'app_notrpython.Hidden',
+        }

Added: pypy/trunk/pypy/module/_testing/app_notrpython.py
==============================================================================
--- (empty file)
+++ pypy/trunk/pypy/module/_testing/app_notrpython.py	Wed Sep  2 13:27:04 2009
@@ -0,0 +1,6 @@
+# NOT_RPYTHON
+
+class Hidden(object):
+
+    def meth(self):
+        return 'hidden'



More information about the Pypy-commit mailing list