I changed
@patch('stdLib.StdObject', autospec=True)
to
@patch('stdLib.StdObject', **{'return_value.raiseError.side_effect': Exception()})
and removed the # <--- do not work
line.
It’s now working.
This is a good example.
EDIT:
mockedObj.raiseError.side_effect = Mock(side_effect=Exception('Test'))
also works.