[pypy-svn] rev 2080 - in pypy/trunk/src/pypy/translator: test tool

sanxiyn at codespeak.net sanxiyn at codespeak.net
Sun Oct 26 15:35:12 CET 2003


Author: sanxiyn
Date: Sun Oct 26 15:35:12 2003
New Revision: 2080

Modified:
   pypy/trunk/src/pypy/translator/test/snippet.py
   pypy/trunk/src/pypy/translator/test/test_pyrextrans.py
   pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py
Log:
Moved a test at the end of buildpyxmodule to the place
where it belongs.


Modified: pypy/trunk/src/pypy/translator/test/snippet.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/snippet.py	(original)
+++ pypy/trunk/src/pypy/translator/test/snippet.py	Sun Oct 26 15:35:12 2003
@@ -150,3 +150,9 @@
         lst = lst[1:-1]
         i = i + 1
     return i
+
+def int_id(x):
+    i = 0
+    while i < x:
+        i = i + 1
+    return i

Modified: pypy/trunk/src/pypy/translator/test/test_pyrextrans.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/test_pyrextrans.py	(original)
+++ pypy/trunk/src/pypy/translator/test/test_pyrextrans.py	Sun Oct 26 15:35:12 2003
@@ -52,6 +52,10 @@
         self.assertEquals(branch_id(1, 2, 3), 2)
         self.assertEquals(branch_id(0, 2, 3), 3)
 
+    def test_int_id(self):
+        int_id = self.build_cfunc(t.int_id)
+        self.assertEquals(int_id(3), 3)
+
     def dont_test_attrs(self):
         attrs = self.build_cfunc(t.attrs)
         self.assertEquals(attrs(), 9)

Modified: pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/buildpyxmodule.py	Sun Oct 26 15:35:12 2003
@@ -1,4 +1,3 @@
-
 import autopath
 from pypy.tool import test
 from pypy.tool.udir import udir
@@ -8,7 +7,7 @@
 from pypy.translator.genpyrex import GenPyrex
 
 import os, sys, inspect
-import stdoutcapture
+from pypy.translator.tool import stdoutcapture
 
 debug = 0
 
@@ -107,7 +106,7 @@
     funcgraph = space.build_flow(func)
 
     if dot:
-        from make_dot import DotGen
+        from pypy.translator.tool.make_dot import DotGen
         dotgen = DotGen()
         subgraphs = []
         subgraphs.append(dotgen.getsubgraph(name, funcgraph))
@@ -149,17 +148,4 @@
             str(base.newext('ps')),
             str(base.newext('.dot'))))
 
-
     return getattr(mod, func.func_name)
-
-if __name__ == '__main__':
-    def f(x):
-        i = 0
-        while i < x:
-            i = i + 1
-        return i
-
-    cf = make_cfunc(f, inputargtypes = [int])
-    assert cf(3), 3
-
-


More information about the Pypy-commit mailing list