How do we unit test tasks and flows in Prefect 2.0...
# prefect-community
a
How do we unit test tasks and flows in Prefect 2.0? I am getting the following error on my test cases after upgrading.
Tasks cannot be run outside of a flow. To call the underlying task function outside of a flow use
task.fn()
I tried
with prefect_test_harness():
but no luck... Ah. Never mind, I should have been reading the error more. Calling
fn
instead of
run
fixes old test cases.
1
n
there are some great examples that live in our numerous collections repos, like this one