https://prefect.io logo
m

Matias

11/27/2019, 11:57 AM
Hi, are there any examples, best practices or guides anywhere on how to write tests for your tasks and pipelines? The docs have a section of testing, but as far as i can see that’s mostly about testing prefect itself, not the things you implement with prefect. Also, there are tests within prefect core project, but that is not the best source of getting started and understanding why things are done in certain way.
it would be also useful to know the best practices around creating and structuring a project, as all the examples are simple 1 file scripts.
j

josh

11/27/2019, 1:23 PM
Hey @Matias currently I am not aware of any guides or examples around testing or structuring projects which use Prefect. The engine’s current unit test section has some examples buried in it on testing aspects of Flows e.g. https://github.com/PrefectHQ/prefect/blob/master/tests/core/test_flow.py#L2305 but that is well hidden and could use some frontward clarification! Prefect definitely makes it easy to test due to the well designed mechanism of State in the library but it needs to be made known! This is a great opportunity for some new docs! I’ll open an issue to track the documentation additions. https://github.com/PrefectHQ/prefect/issues/1780 In the meantime I encourage anyone who has been testing and structuring their flows to chime in with how they accomplished it! I have seen cases where users either break up their flow components or keep them all together in a script-like manner because Prefect is generally agnostic to how it is implemented 🙂
m

Matias

11/27/2019, 3:53 PM
I see, thank you for the explanation. I look forward to seeing some examples from the community or in your docs.