I'm testing exceptions with nose. Here's an example:
"Test exception is raised when trying to delete non-existent users"
# make nose fail here
nose provides tools for testing exceptions (like unittest does). Try this example (and read about the other tools at Nose Testing Tools
from nose.tools import * l =  d = dict() @raises(Exception) def test_Exception1(): '''this test should pass''' l.pop() @raises(KeyError) def test_Exception2(): '''this test should pass''' d @raises(KeyError) def test_Exception3(): '''this test should fail (IndexError raised but KeyError was expected)''' l.pop() def test_Exception4(): '''this test should fail with KeyError''' d
I would think that this is the proper way that you were looking for because it lets you be specific about the exceptions that you expect or want. So you actually provoke the error to see that it raises the right exception. And then you let nose evaluate the result. (Put as little logic into the unit tests as possible!)