_recorder doesn't record when there's an exception
olivierdalang opened this issue · comments
Describe the bug
When decorating a function with recorder, nothing gets recorded if an exception is thrown in the function.
Additional context
No response
Version of responses
0.24.1
Steps to Reproduce
class MyTestCase(TestCase):
@_recorder.record(file_path="a.yaml")
def test_a(self):
requests.get("https://example.com", verify=False)
@_recorder.record(file_path="b.yaml")
def test_b(self):
requests.get("https://example.com", verify=False)
self.assertEqual(1, 2) # throws an exception
Expected Result
Requests should be recorded in both tests (files a.yaml and b.yaml should be created)
Actual Result
Requests are only recorded in a (file b.yaml is NOT created)