You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the latest version is no longer possible to raise an exception from a Stub. Version 3.0 was working just fine. The problem is that the line checking is the returned value was an instance of exception was deleted from the method _expectation_value.
See the attached test below:
import os
from unittest import TestCase
from ludibrio import Stub, Mock
class TestRaiseException(TestCase):
def test_stub_raise_exception(self):
with Stub() as exists:
exists() >> Exception('exist raised a mocked exception from stub')
with self.assertRaises(Exception):
exists()
exists.restore_import()
def test_mock_rasise_exception(self):
with Mock() as exists:
exists() >> Exception('exist raised a mocked exception from stub')
with self.assertRaises(Exception):
exists()
exists.validate()
The text was updated successfully, but these errors were encountered:
I'm glad that I wasn't the only one who ran into this issue! I have created pull request: #13 to resolve this issue. Currently under review by the great @nsigustavo
Can we get a bump on this? I just found this and it seems much easier to use than mock. I reviewed the code and it looks good to me.. just my two cents.
In the latest version is no longer possible to raise an exception from a Stub. Version 3.0 was working just fine. The problem is that the line checking is the returned value was an instance of exception was deleted from the method _expectation_value.
See the attached test below:
The text was updated successfully, but these errors were encountered: