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

[bug] and_return_result_of doesn't correctly handle async methods #15

Open
jmaliksi opened this issue Apr 24, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@jmaliksi
Copy link
Contributor

    def return_value(self, *args, **kwargs):
        """Extracts the real value to be returned from the wrapping callable.

        :return: The value the double should return when called.
        """

        self._called()
>       return self._return_value(*args, **kwargs)
E       TypeError: 'coroutine' object is not callable

if you create an allowance on an async method and use and_return_result_of you get the above error. I think this specifically will only happen when the fake is expecting arguments as the default usage that and_return does hides the error by wrapping argument-less _return_value in a lambda

@toddsifleet toddsifleet self-assigned this Aug 3, 2024
@toddsifleet toddsifleet added the bug Something isn't working label Aug 3, 2024
@toddsifleet
Copy link
Contributor

I found the issue, working on a solution.

This was referenced Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants