Hi, I am trying to run tests on flows that have re...
# ask-community
p
Hi, I am trying to run tests on flows that have result persistence activated. However, I can't figure out how to circumvent persistence or mock the storage block.
Copy code
@flow(
    name=FLOW_NAME,
    persist_result=True,
    result_storage=S3.load("s3-flow-storage"),
    result_serializer=JSONSerializer(),
)
def aggregate_events():
   logic()
When trying to simply create a block in the Prefect test fixture, Prefect doesn't recognize this block's existence, resulting in the error `Unable to find block document named s3-flow-storage for block type s3`:
Copy code
@pytest.fixture(autouse=True, scope="session")
def prefect_fixture():
    with prefect_test_harness():
        S3(bucket_path="bucket").save("s3-flow-storage")
When trying to disable result persistence dynamically in the test, it seems to have no effect (same error as above):
Copy code
aggregate_events.with_options(result_storage=None, persist_result=False)()
Am I missing something? How does one go about this? Appreciate the help!