[pypy-svn] r26214 - in pypy/dist/pypy/translator/cl: . test

sanxiyn at codespeak.net sanxiyn at codespeak.net
Mon Apr 24 04:45:03 CEST 2006


Author: sanxiyn
Date: Mon Apr 24 04:44:59 2006
New Revision: 26214

Modified:
   pypy/dist/pypy/translator/cl/buildcl.py
   pypy/dist/pypy/translator/cl/test/test_cltrans.py
Log:
(sanxiyn, nik, yusei)
Moved test utilities out of test script


Modified: pypy/dist/pypy/translator/cl/buildcl.py
==============================================================================
--- pypy/dist/pypy/translator/cl/buildcl.py	(original)
+++ pypy/dist/pypy/translator/cl/buildcl.py	Mon Apr 24 04:44:59 2006
@@ -1,4 +1,6 @@
 import autopath
+import os
+import py
 
 from pypy.objspace.flow import FlowObjSpace
 from pypy.translator.translator import TranslationContext
@@ -6,6 +8,28 @@
 from py.process import cmdexec 
 from pypy import conftest
 
+def is_on_path(name):
+    try:
+        py.path.local.sysfind(name)
+    except py.error.ENOENT:
+        return False
+    else:
+        return True
+
+def cl_detect():
+    cl = os.getenv("PYPY_CL")
+    if cl:
+        return cl
+    if is_on_path("clisp"):
+        return "clisp"
+    if is_on_path("lisp"):
+        if is_on_path("cmuclinvoke.sh"):
+            return "cmuclinvoke.sh"
+    if is_on_path("sbcl"):
+        if is_on_path("sbclinvoke.sh"):
+            return "sbclinvoke.sh"
+    return None
+
 class Literal:
     def __init__(self, val):
         self.val = val

Modified: pypy/dist/pypy/translator/cl/test/test_cltrans.py
==============================================================================
--- pypy/dist/pypy/translator/cl/test/test_cltrans.py	(original)
+++ pypy/dist/pypy/translator/cl/test/test_cltrans.py	Mon Apr 24 04:44:59 2006
@@ -4,37 +4,18 @@
 import os
 from pypy.objspace.flow import FlowObjSpace 
 
+
+from pypy.translator.cl.buildcl import cl_detect, _make_cl_func
+from pypy.translator.cl.buildcl import Literal
+
 def setup_module(mod): 
-    mod.global_cl = os.getenv("PYPY_CL")
-    if not mod.global_cl:  
-        mod.global_cl = cl_detect()
-
-def cl_detect():
-    if is_on_path("clisp"):
-        return "clisp"
-    if is_on_path("lisp"):
-        if is_on_path("cmuclinvoke.sh"):
-            return "cmuclinvoke.sh"
-    if is_on_path("sbcl"):
-        if is_on_path("sbclinvoke.sh"):
-            return "sbclinvoke.sh"
-    return None
-
-def is_on_path(name):
-    try:
-        py.path.local.sysfind(name) 
-    except py.error.ENOENT: 
-        return False 
-    else: 
-        return True 
+    mod.global_cl = cl_detect()
 
 def make_cl_func(func, argtypes=[]):
-    from pypy.translator.cl.buildcl import _make_cl_func
     return _make_cl_func(func, global_cl, udir, argtypes)
 
 
 from pypy.translator.test import snippet as t
-from pypy.translator.cl.buildcl import Literal
 
 class TestGenCLTestCase:
     def setup_class(cls): 



More information about the Pypy-commit mailing list