[pypy-svn] r79559 - pypy/trunk/pypy/rlib/test
antocuni at codespeak.net
antocuni at codespeak.net
Fri Nov 26 15:30:53 CET 2010
Author: antocuni
Date: Fri Nov 26 15:30:51 2010
New Revision: 79559
Modified:
pypy/trunk/pypy/rlib/test/test_libffi.py
Log:
ops, fix the test for when we run it translated (and the exception we get is an LLException)
Modified: pypy/trunk/pypy/rlib/test/test_libffi.py
==============================================================================
--- pypy/trunk/pypy/rlib/test/test_libffi.py (original)
+++ pypy/trunk/pypy/rlib/test/test_libffi.py Fri Nov 26 15:30:51 2010
@@ -264,7 +264,22 @@
assert res == initval+1
def test_wrong_number_of_arguments(self):
+ from pypy.rpython.llinterp import LLException
libfoo = self.get_libfoo()
func = (libfoo, 'sum_xy', [types.sint, types.double], types.sint)
- py.test.raises(TypeError, "self.call(func, [38], rffi.LONG)") # one less
- py.test.raises(TypeError, "self.call(func, [38, 12.3, 42], rffi.LONG)") # one more
+
+ glob = globals()
+ loc = locals()
+ def my_raises(s):
+ try:
+ exec s in glob, loc
+ except TypeError:
+ pass
+ except LLException, e:
+ if str(e) != "<LLException 'TypeError'>":
+ raise
+ else:
+ assert False, 'Did not raise'
+
+ my_raises("self.call(func, [38], rffi.LONG)") # one less
+ my_raises("self.call(func, [38, 12.3, 42], rffi.LONG)") # one more
More information about the Pypy-commit
mailing list