Are there any examples of running local unit tests...
# prefect-server
Are there any examples of running local unit tests to verify your tasks are working? I'd like to have some pre-deployment checks in my GitHub actions.
So far we have: • this page about unit-testing flows and tasks • this discussion about CI/CD in Prefect with several examples from other users
Thank you. I've got my first flow reading in to my test with
but I'm struggling to figure out how I might override a default parameter before calling it with
. Is there a way to do that?
for sure, but can you explain what exactly do you mean? Parameter defaults can be provided in their definition and when triggering a flow run, you can overwrite them e.g. the
task (or mutation) allow you to pass your custom parameter values
Ah. create_flow_run must be what I need! I'll try it. Thank you.
👍 1
Here is the overly simplistic idea I'm trying that is failing. Clearly I'm missing something obvious about how to approach this.
Copy code
flow = extract_flow_from_file("")
    assert len(flow.tasks) == 4
            "scrapers": ["ia"],
For me, I think the helpful example would be a simple doc that shows "Here's how you import your flow and run it inside a test."
yup, you can import your flow object within your tests. Nice that you found it