David Clements

02/16/2021, 12:20 AM
Hey There -- One of the reasons we are considering moving to prefect is to get better testing coverage. I am looking for examples how how to test Flows including any approach to mocking out Tasks. Anyone have any pointers?

Chris White

02/16/2021, 1:32 AM
For specifically mocking out tasks, I’d recommend using
which will allow you to swap out a given task with another task; at this moment Prefect doesn’t offer an off-the-shelf task mock, but now that you’ve asked I think it’s something we’ll look into! For other forms of testing (injecting state, testing triggers, etc.) check out this SO answer:
I should also call out that you can test your task’s specific logic by calling
with the appropriate kwargs and with any mocks you may need
👍 1
👀 2