https://prefect.io logo
Title
d

Deceivious

05/12/2023, 9:57 AM
HI, I am some queries about
testing
.
@flow
def flow():
    #SOME STUFF HERE
    normal_function()
    #SOME OTHER STUFF HERE

def normal_function():
    return some_task()

@task
def some_task():
    return True
I want to assert that `normal_function`returns
True
.
The issue is
some_task
is a prefect task and needs to be flow context. I am testing
normal_function
so my codes cannot invoke
.fn
method of prefect task to run the function directly.
a

Abhishek Mitra

05/12/2023, 12:50 PM
Have you tried using
.fn
for some_task()? change your normal_function:
def normal_function():
    return some_task.fn()
d

Deceivious

05/12/2023, 1:23 PM
Well if i do that
some_task
will no longer be a task Even outside the test.