For testing flows: <
# prefect-community
For testing flows: , when you run anything with
do you need to have the prefect server up? As my test just seems to hang once it hits that part.
👀 1
Hi! No you do not need server in this case --
should start the flow run instantly — if there is a schedule on the flow it will wait for the schedule, but otherwise execution should start immediately in-process. Is there any output at all or does it immediately hang?
Hi Laura, thanks for the reply, doh, just realised there's a schedule on the task -- how do you go about testing scheduled tasks?
Ah, just did
flow.schedule = None
and that worked also
Awesome yeah, for quick testing of a scheduled flow in general you’ll want to take the schedule off (or if you are in an automated testing framework and really want to test the schedule, mock the time)
nice, thanks for the help. I'll look for an example in the prefect tests themselves.
Great! Doing a super quick perusal myself, it looks like we mostly unittest the internals of schedules more than mock time at all, but as a personal recommendation if you wanted to automate an end-to-end test for a flow with a schedule on it yourself including testing that it trips at the time you expect, you might use something like
if you haven’t before (
TIL freezegun
I was like wowzer freezegun seems rad, can't wait to tell the team about it. Go to pip install it to try it out... already installed haha
😂 1