Skip to content

@mock function reference #81

@omus

Description

@omus

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions