I am trying to write some nose tests for a python project. It has been a while (a year or so) since I last wrote some nostests and it looks like nose2 is the suggested module to use for this now.
I want to write a test to check that an exception is raised when the wrong value is sent into a def function. I know in nose is was used like this:
from nose.tools import assert_raises
def add(x, y):
return x + y
assert_raises(TypeError, add, 2, "0")
I just can't find an equivalent use example for nose2, none of these imports work (there is a suggestion that nose2 is more like unittest than nose, which seems to use assertRaises):
from nose2 import assert_raises
from nose2 import assertRaises
from nose2.tools import assert_raises
from nose2.tools import assertRaises
A search of the nose2 documentation website has no mention of an assert_raises or assertRaises