[pypy-svn] r17411 - pypy/dist/pypy/interpreter/pyparser/test

arigo at codespeak.net arigo at codespeak.net
Fri Sep 9 17:20:10 CEST 2005


Author: arigo
Date: Fri Sep  9 17:20:09 2005
New Revision: 17411

Added:
   pypy/dist/pypy/interpreter/pyparser/test/__init__.py
      - copied unchanged from r17408, pypy/dist/pypy/interpreter/test/__init__.py
   pypy/dist/pypy/interpreter/pyparser/test/autopath.py
      - copied unchanged from r17408, pypy/dist/pypy/interpreter/test/autopath.py
   pypy/dist/pypy/interpreter/pyparser/test/stdlib_testall.py
Modified:
   pypy/dist/pypy/interpreter/pyparser/test/test_astcompiler.py
Log:
Added a test module to exercices our ast builder and compiler on the
complete standard library (lib-python/2.4.1).

The test file is not called test_*.py to avoid it being run by default.
(Takes too much time and crashes quite a bit at the moment.)



Added: pypy/dist/pypy/interpreter/pyparser/test/stdlib_testall.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/interpreter/pyparser/test/stdlib_testall.py	Fri Sep  9 17:20:09 2005
@@ -0,0 +1,16 @@
+import autopath
+import py
+from test_astcompiler import check_compile
+
+
+def check_file_compile(filename):
+    print 'Compiling:', filename
+    source = open(filename).read()
+    check_compile(source, 'exec', quiet=True)
+
+
+def test_all():
+    p = py.path.local(autopath.pypydir).dirpath().join('lib-python', '2.4.1')
+    for s in p.listdir():
+        if s.check(ext='.py'):
+            yield check_file_compile, str(s)

Modified: pypy/dist/pypy/interpreter/pyparser/test/test_astcompiler.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/test/test_astcompiler.py	(original)
+++ pypy/dist/pypy/interpreter/pyparser/test/test_astcompiler.py	Fri Sep  9 17:20:09 2005
@@ -125,8 +125,9 @@
                      tuple(rcode.co_cellvars) )
     return code
 
-def check_compile(expr, target='exec'):
-    print "Compiling:", expr
+def check_compile(expr, target='exec', quiet=False):
+    if not quiet:
+        print "Compiling:", expr
     sc_code = compile_with_stablecompiler(expr, target=target)
     ac_code = compile_with_astcompiler(expr, target=target)
     compare_code(ac_code, sc_code)



More information about the Pypy-commit mailing list