Morten Hauge
01/15/2024, 8:32 AM@task(retries=5)
etc. during my tests without resorting to mocking?Morten Hauge
01/15/2024, 9:47 AMMorten Hauge
01/15/2024, 9:48 AMMorten Hauge
01/15/2024, 9:49 AMJessica Smith
01/15/2024, 6:37 PMMorten Hauge
01/15/2024, 6:40 PMJessica Smith
01/15/2024, 6:41 PMNate
01/15/2024, 11:34 PMfrom copy import copy
from prefect import flow
@flow(retries=1)
def foo():
raise ValueError("ack")
foo_ = copy(foo) # you could modify `foo` here directly too if you wanted to skip this
foo_.retries = None
foo_() # immediately fails without retry
Morten Hauge
01/16/2024, 9:08 AM.submit
and checking the state. I could always get away with a MagicMock
but at that point it's becoming more and more a unit test and less of an integration / e2e test. I guess that might play into why there isn't an obvious OOB solution for this yet.Nate
01/16/2024, 1:09 PMBut that would just modify the flow itselfyeah or the copy you care about in your testing - can you explain your situation where your unit tests depend on the flow/task settings?