Lukáš Pravda
06/27/2023, 4:02 PMfrom prefect import Flow, task, Parameter
@task
def add(a, b):
return a + b
with Flow("test") as flow:
a = Parameter(name="a")
b = Parameter(name="b")
add(a,b)
how does write a test case to mock add()
task? What I’d normally do would be this: but this does not work
@patch.object(flow_module.add, "run")
def test_foo(self, mock):
flow_module.flow.run(parameters={"a": 1, "b": 2})
assert mock.call_count == 1
Advices, suggestions? Please dont say move to prefect 2.0 🙂 Thank you!