Python, mock: raise exception
<p>I'm having issues raising an exception from a function in my test:</p>

<pre><code>### Implemetation
def MethodToTest():
    myVar = StdObject()
    try:
        myVar.raiseError() # &lt;--- here
        return True
    except Exception as e:
        # ... code to test
        return False

### Test file
@patch('stdLib.StdObject', autospec=True)
def test_MethodeToTest(self, mockedObjectConstructor):
    mockedObj = mockedObjectConstructor.return_value
    mockedObj.raiseError.side_effect = Exception('Test') # &lt;--- do not work
    ret = MethodToTest()
    assert ret is False
</code></pre>

<p>I would like to <code>raiseError()</code> function to raise an error.</p>

<p>I found several examples on SO, but none that matched my need.</p>