Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_recorder doesn't record when there's an exception #705

Open
olivierdalang opened this issue Feb 6, 2024 · 0 comments
Open

_recorder doesn't record when there's an exception #705

olivierdalang opened this issue Feb 6, 2024 · 0 comments
Labels

Comments

@olivierdalang
Copy link

olivierdalang commented Feb 6, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants