[pypy-svn] r72320 - pypy/branch/kill-python-h/pypy/translator/c/test
arigo at codespeak.net
arigo at codespeak.net
Wed Mar 17 17:50:16 CET 2010
Author: arigo
Date: Wed Mar 17 17:50:14 2010
New Revision: 72320
Modified:
pypy/branch/kill-python-h/pypy/translator/c/test/test_math.py
Log:
Turn this test into a standalone test.
Modified: pypy/branch/kill-python-h/pypy/translator/c/test/test_math.py
==============================================================================
--- pypy/branch/kill-python-h/pypy/translator/c/test/test_math.py (original)
+++ pypy/branch/kill-python-h/pypy/translator/c/test/test_math.py Wed Mar 17 17:50:14 2010
@@ -1,6 +1,6 @@
import py, math
from pypy.module.math.test import test_direct
-from pypy.translator.c.test.test_genc import compile
+from pypy.translator.c.test.test_standalone import StandaloneTests
def get_test_case((fnname, args, expected)):
@@ -25,18 +25,25 @@
testfnlist = [get_test_case(testcase)
for testcase in test_direct.MathTests.TESTCASES]
+reprlist = [repr(testcase)
+ for testcase in test_direct.MathTests.TESTCASES]
-def fn():
+def fn(args):
+ err = False
for i in range(len(testfnlist)):
testfn = testfnlist[i]
if not testfn():
- return i
- return -42 # ok
-
-def test_math():
- f = compile(fn, [])
- res = f()
- if res >= 0:
- py.test.fail(repr(test_direct.MathTests.TESTCASES[res]))
- else:
- assert res == -42
+ print "error:", reprlist[i]
+ err = True
+ if not err:
+ print "all ok"
+ return 0
+
+class TestMath(StandaloneTests):
+ def test_math(self):
+ t, cbuilder = self.compile(fn)
+ data = cbuilder.cmdexec('')
+ if "error:" in data:
+ py.test.fail(data.strip())
+ else:
+ assert "all ok" in data
More information about the Pypy-commit
mailing list