I am writing a test to run a flow which uses blocks.
from prefect.testing.utilities import prefect_test_harness from flows.flow import ( my_flow, Parameters ) def test_my_flow(): with prefect_test_harness(): my_flow( parameters=Parameters( model_filesystem_slug="local-file-system/models", predictions_filesystem_slug="local-file-system/predictions", ) )
However, it doesn’t seem able to find the block definitions even after I do
prefect profile use <profile_with_blocks> before running the test.
ValueError: Unable to find block document named <block-name> for block type <block-type>
Are there any examples of running flow tests that use blocks?
If I simply run the flow with
python path/to/flow.py it works fine and has access to all the blocks, but I want to add the flow tests to the CI.