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

@mock function reference #81

Open
omus opened this issue Jul 20, 2020 · 0 comments
Open

@mock function reference #81

omus opened this issue Jul 20, 2020 · 0 comments

Comments

@omus
Copy link
Member

omus commented Jul 20, 2020

I encountered a scenario where I wanted to use @mock not on a call site but rather on a reference to a function:

upload_with_retry = retry(upload, delays=fill(5.0, retries))
responses = upload_with_retry(ftp, file, "/")

Due to the actual call of upload occurring within retry I can't actually get at the actual call site I'd like to mock. Currently you can rewrite this code to be:

upload_with_retry = retry((args...) -> @mock(upload(args...)), delays=fill(5.0, retries))
responses = upload_with_retry(ftp, file, "/")

Which makes me feel like we should update @mock to allow just @mock upload to re-write the expression to essentially be (args; kwargs...) -> @mock upload(args...; kwargs...). I also have a suspicion this will help with solving #80

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

No branches or pull requests

1 participant