Use pytest.raises

If you want to assert that some code raises an exception you can use the raises helper.