this should test and fix the same issue that was committed in
the pypy svn-repo as r72534 --HG-- branch : trunk
This commit is contained in:
parent
b3a05b545e
commit
0b24a70279
|
@ -100,7 +100,7 @@ def raises(ExpectedException, *args, **kwargs):
|
|||
k = ", ".join(["%s=%r" % x for x in kwargs.items()])
|
||||
if k:
|
||||
k = ', ' + k
|
||||
expr = '%s(%r%s)' %(func.__name__, args, k)
|
||||
expr = '%s(%r%s)' %(getattr(func, '__name__', func), args, k)
|
||||
raise ExceptionFailure(msg="DID NOT RAISE",
|
||||
expr=args, expected=ExpectedException)
|
||||
|
||||
|
|
|
@ -15,6 +15,16 @@ class TestRaises:
|
|||
def test_raises_function(self):
|
||||
py.test.raises(ValueError, int, 'hello')
|
||||
|
||||
def test_raises_callable_no_exception(self):
|
||||
from py._test.outcome import ExceptionFailure
|
||||
class A:
|
||||
def __call__(self):
|
||||
pass
|
||||
try:
|
||||
py.test.raises(ValueError, A())
|
||||
except ExceptionFailure:
|
||||
pass
|
||||
|
||||
def test_pytest_exit():
|
||||
try:
|
||||
py.test.exit("hello")
|
||||
|
|
Loading…
Reference in New Issue