I was wondering, after thoroughly looking in the d...
# prefect-community
I was wondering, after thoroughly looking in the documentation, that how could I execute a single task on it’s own from a flow?
Hey @Andor Tóth! For testing purposes or in an
session, you can run a task by calling the task’s run method directly:
Copy code
from prefect import task

def my_task():
    print("Hello, World!")

output = my_task.run()
Let me know if that doesn’t answer your question
This technique would be good to add to the documentation. Perhaps a small section with recommendations on how best to unit test tasks/flows, could cover this technique.
@Nicholas Perrott great suggestion! There’s a small note here: https://docs.prefect.io/core/getting_started/why-not-airflow.html#local-testing but I think that’s a bit hard to find. I’ll open an issue 👍