Hi Prefect community, I am running into a problem...
# ask-community
w
Hi Prefect community, I am running into a problem with
PyTest
when trying to build an end to end test on a newly deployed prefect flow. With this code:
Copy code
from prefect.deployments import run_deployment
def test_flow_deployment(flow_name: str) -> None:
    deployment = run_deployment(name = flow_name)
When I run it through PyTest (e.g.
pytest my_prefect_test.py
) I get the following error:
Copy code
except httpx.HTTPStatusError as e:
            if e.response.status_code == status.HTTP_404_NOT_FOUND:
>               raise prefect.exceptions.ObjectNotFound(http_exc=e) from e
E               prefect.exceptions.ObjectNotFound
However, when I run
python my_prefect_test.py
in the same terminal, there are no errors and the SDK call successfully reaches the prefect cloud and sets off a flow. Does anybody have any ideas? Prefect version
2.12.4
d
You're using the test harness in a session fixture somewhere, correct?
Assuming you are, then you have to recreate the deployment in the testing environment. Same thing goes for blocks. The harness is pretty much a clean slate and has no knowledge of what's in your Prefect Cloud.
w
Hey Dominic, no I'm not using the
prefect_test_harness