[pypy-svn] r25807 - pypy/dist/pypy/translator/squeak/test

nik at codespeak.net nik at codespeak.net
Thu Apr 13 17:59:28 CEST 2006


Author: nik
Date: Thu Apr 13 17:59:26 2006
New Revision: 25807

Modified:
   pypy/dist/pypy/translator/squeak/test/runtest.py
   pypy/dist/pypy/translator/squeak/test/test_llops.py
Log:
make squeak llops tests skip earlier (thanks for the hint, hpk). it seemed
to me like the overhead was mostly due to the generative tests not really
the relatively late skips. 


Modified: pypy/dist/pypy/translator/squeak/test/runtest.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/test/runtest.py	(original)
+++ pypy/dist/pypy/translator/squeak/test/runtest.py	Thu Apr 13 17:59:26 2006
@@ -8,6 +8,18 @@
 def compile_function(func, annotation=[], graph=None):
     return SqueakFunction(func, annotation, graph)
 
+def squeak_checks():
+    try:
+        import posix
+    except ImportError:
+        py.test.skip("Squeak tests only work on Unix right now.")
+    try:
+        py.path.local.sysfind("squeak")
+    except py.error.ENOENT:
+        py.test.skip("Squeak is not on your path.")
+    if os.getenv("SQUEAK_IMAGE") is None:
+        py.test.skip("Squeak tests expect the SQUEAK_IMAGE environment "
+                "variable to point to an image.")
 
 # For now use pipes to communicate with squeak. This is very flaky
 # and only works for posix systems. At some later point we'll
@@ -32,6 +44,7 @@
 class SqueakFunction:
 
     def __init__(self, func, annotation, graph=None):
+        squeak_checks()
         self._func = func
         self._gen = self._build(func, annotation, graph)
 
@@ -78,17 +91,6 @@
 
     def __call__(self, *args):
         # NB: only integers arguments are supported currently
-        try:
-            import posix
-        except ImportError:
-            py.test.skip("Squeak tests only work on Unix right now.")
-        try:
-            py.path.local.sysfind("squeak")
-        except py.error.ENOENT:
-            py.test.skip("Squeak is not on your path.")
-        if os.getenv("SQUEAK_IMAGE") is None:
-            py.test.skip("Squeak tests expect the SQUEAK_IMAGE environment "
-                    "variable to point to an image.")
         startup_st = self._write_startup()
         options = "-headless"
         if hasattr(conftest, "showsqueak") and conftest.option.showsqueak:

Modified: pypy/dist/pypy/translator/squeak/test/test_llops.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/test/test_llops.py	(original)
+++ pypy/dist/pypy/translator/squeak/test/test_llops.py	Thu Apr 13 17:59:26 2006
@@ -1,5 +1,5 @@
 import sys
-from pypy.translator.squeak.test.runtest import compile_function
+from pypy.translator.squeak.test.runtest import compile_function, squeak_checks
 from pypy.rpython.rarithmetic import r_uint, r_longlong, r_ulonglong
 from pypy.rpython.annlowlevel import LowLevelAnnotatorPolicy
 from pypy.rpython.lltypesystem.lloperation import llop
@@ -7,6 +7,9 @@
 from pypy.rpython.lltypesystem.lltype import SignedLongLong, UnsignedLongLong, Float
 from pypy.rpython.test.test_llinterp import interpret
 
+def setup_module(mod):
+    squeak_checks()
+
 def optest(testcase):
     llopname = testcase[0]
     RESTYPE = testcase[1] 



More information about the Pypy-commit mailing list